[英]How to keep hibernate3-maven-plugin HBM2DDL from printing to console
我使用了hibernate3-maven-plugin来自动创建一个SQL脚本,该脚本可用于在新数据库中创建数据库架构。 我通过hbm2ddl工具执行此操作。 我以为,当我指示它将SQL写入文件时,它将停止使50页SQL的Maven构建混乱。 无论如何要使其停止写入控制台,而只写入文件? 找不到答案!
将此添加到此插件的配置中:
<componentProperties>
...
<console>false</console>
...
</componentProperties>
<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>
有一个名为“控制台”的属性,您只需将其设置为“ false”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.