Question

I used 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!

Was it helpful?

Solution

Add this to the config for this plugin:

<componentProperties>
  ...
  <console>false</console>
  ...
</componentProperties>

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top