簡體   English   中英

如何保持hibernate3-maven-plugin HBM2DDL從打印到控制台

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM