views:

42

answers:

1

Our application needs to use two different kinds of databases.One is oracle, the other is mysql and we want to use maven plugin hbm2ddl to generate the ddl file, and want to output the two ddl files at the same time, I don't know how to set the configuration in pom.xml. I tried to use this plugin twice, but it always generated one ddl file. Any one encountered such case before ? could u please give some advice.

+1  A: 

don't use the plugin twice, use the same plugin with two executions

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