2010-05-28 44 views
0

我們的應用程序需要使用兩種不同的數據庫。一個是oracle,另一個是mysql,我們想用maven插件hbm2ddl生成ddl文件,並且想要同時輸出這兩個ddl文件,我不知道如何在pom.xml中設置配置。我試圖使用這個插件兩次,但它總是生成一個ddl文件。任何人遇到過這種情況?你能否提出一些建議?如何使用maven hbm2ddl插件同時輸出兩個ddl文件

回答

2

不使用插件的兩倍,使用相同的插件有兩個執行

<plugin> 
    <groupId>org.codehaus.mojo</groupId> 
    <artifactId>hibernate3-maven-plugin</artifactId> 
    <version>2.2</version> 
    <configuration> 
     <!--common configuration here --> 
    </configuration> 
    <executions> 
     <execution> 
      <id>db1</id> 
      <goals> 
       <goal>hbm2ddl</goal> 
      </goals> 
      <configuration> 
       <!-- db-specific configuration here --> 
      </configuration> 
     </execution> 
     <execution> 
      <id>db2</id> 
      <goals> 
       <goal>hbm2ddl</goal> 
      </goals> 
      <configuration> 
       <!-- db-specific configuration for second db here --> 
      </configuration> 
     </execution> 
    </executions> 
    </plugin> 
相關問題