开发者

How to keep hibernate3-maven-plugin HBM2DDL from printing to console

开发者 https://www.devze.com 2023-01-02 10:28 出处:网络
I used开发者_StackOverflow the hibernate3-maven-plugin to automatically create a SQL script I can use to create a database schema in a new database.I do this via the hbm2ddl tool.I thought that when I

I used开发者_StackOverflow the hibernate3-maven-plugin to automatically create a SQL script I can use to create a database schema in a new database. I do this via the hbm2ddl tool. I thought that when I instructed it to write the SQL to a file it would stop cluttering up my maven builds with 50 pages of SQL. Anyway to make it stop writing to the console and only write to the file? Can't find the answer!


Add this to the config for this plugin:

<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>

There is a property called "console", you just need to set it as "false"

0

精彩评论

暂无评论...
验证码 换一张
取 消