2010-06-04 53 views
0

我使用hibernate3-maven-plugin自動創建一個SQL腳本,我可以使用它在新數據庫中創建數據庫模式。我通過hbm2ddl工具執行此操作。我認爲,當我指示它將SQL寫入文件時,它會停止使用50頁SQL對我的Maven構建造成混亂。無論如何,要停止寫入控制檯,只寫入文件?找不到答案!如何保持hibernate3-maven插件HBM2DDL從打印到控制檯

回答

2

一下添加到config這個插件:

<componentProperties> 
    ... 
    <console>false</console> 
    ... 
</componentProperties> 
0
<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> 

有一個名爲「控制檯」的屬性,你只需要將其設置爲「假」