0

我们的应用需要用到两种不同的数据库,一种是oracle,一种是mysql,我们想用maven插件hbm2ddl生成ddl文件,想同时输出两个ddl文件,我没有知道如何在 pom.xml 中设置配置。我尝试使用这个插件两次,但它总是生成一个 ddl 文件。有没有人遇到过这种情况?你能不能给点建议。

4

1 回答 1

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>
于 2010-05-31T04:46:11.803 回答