如何使Hibernate3-Maven-Plugin HBM2DDL远离打印到控制台
-
24-10-2019 - |
题
我使用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”
不隶属于 StackOverflow