0

我使用 hibernate3-maven-plugin 自动创建一个 SQL 脚本,我可以使用它在新数据库中创建数据库模式。我通过 hbm2ddl 工具执行此操作。我认为当我指示它将 SQL 写入文件时,它会停止用 50 页 SQL 将我的 maven 构建弄得一团糟。无论如何让它停止写入控制台并只写入文件?找不到答案!

4

2 回答 2

2

将此添加到此插件的配置中:

<componentProperties>
  ...
  <console>false</console>
  ...
</componentProperties>
于 2010-07-05T13:44:40.557 回答
0
<plugin>
            <!-- run "mvn hibernate3:hbm2ddl" to generate a schema -->
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>hibernate3-maven-plugin</artifactId>
            <version>3.0</version>
            <executions>
                <execution>
                    <id>create-schema</id>
                    <phase>process-test-resources</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <configuration>
                        <hibernatetool>
                            <classpath>
                                <path location="${project.build.directory}/classes" />
                                <path location="${project.basedir}/src/main/resources" />
                            </classpath>

                            <configuration configurationfile="${project.basedir}/src/main/resources/hibernate.cfg.xml"></configuration>
                            <hbm2ddl create="true" export="false" console="false" destdir="${project.basedir}/target" drop="true" outputfilename="mysql.sql" format="true" />
                        </hibernatetool>
                    </configuration>
                </execution>
            </executions>
        </plugin>

有一个名为“console”的属性,您只需将其设置为“false”

于 2014-01-09T10:07:38.350 回答