liquibase使用maven和两个数据库

时间:2011-02-01 17:20:40

标签: database maven-2 liquibase

我有以下结构从maven运行一个数据库:

<plugin>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-plugin</artifactId>
            <version>1.9.5.0</version>
            <executions>
                <execution>
                    <phase>process-resources</phase>
                    <configuration>
                        <changeLogFile>src/main/resources/db.changelog.xml</changeLogFile>
                        <driver>com.mysql.jdbc.Driver</driver>
                        <url>jdbc:mysql://localhost:3306/charm</url>  
                        <username>***</username>
                        <password>***</password>
                    </configuration>
                    <goals>
                        <goal>update</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

现在我想在名为charm2的同一服务器上运行另一个数据库。我试过这个:

<plugin>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-plugin</artifactId>
            <version>1.9.5.0</version>
            <executions>
                <execution>
                    <phase>process-resources</phase>
                    <configuration>
                        <changeLogFile>src/main/resources/db.changelog.xml</changeLogFile>
                        <driver>com.mysql.jdbc.Driver</driver>
                        <url>jdbc:mysql://localhost:3306/charm</url>  
                        <username>***</username>
                        <password>***</password>
                    </configuration>
                    <goals>
                        <goal>update</goal>
                    </goals>
                </execution>
                <execution>
                    <phase>process-resources</phase>
                    <configuration>
                        <changeLogFile>src/main/resources/db.changelog.xml</changeLogFile>
                        <driver>com.mysql.jdbc.Driver</driver>
                        <url>jdbc:mysql://localhost:3306/charm2</url>  
                        <username>***</username>
                        <password>***</password>
                    </configuration>
                    <goals>
                        <goal>update</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

它不起作用。有谁知道如何解决这个问题?

1 个答案:

答案 0 :(得分:6)

也许您可以尝试为每个<id>提供<execution>。像

这样的东西
...
<execution>
   <id>charm</id>
   <phase>process-resources</phase>
   <configuration>
   ...
</execution>
<execution>
   <id>charm2</id>
   <phase>process-resources</phase>
   <configuration>
   ...
</execution>
...

如果这不起作用,您可以使用完整的堆栈跟踪更新您的问题,指定maven无法验证pom的确切行。