database - liquibase 在两个数据库中使用 Maven

标签 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>

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

最佳答案

也许你可以尝试给出 <id>每个 <execution> .有点像

...
<execution>
   <id>charm</id>
   <phase>process-resources</phase>
   <configuration>
   ...
</execution>
<execution>
   <id>charm2</id>
   <phase>process-resources</phase>
   <configuration>
   ...
</execution>
...

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

关于database - liquibase 在两个数据库中使用 Maven,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4865767/

相关文章:

javascript - 聊天应用程序 - 向 MongoDB 发送多个同时请求

maven - 如何创建 Maven uber jar,其中包含提供范围的依赖项

database - liquibase:如何通过liquibase调用和执行数据库功能?

hibernate - 用于 PostgreSQL 和 H2 的 Liquibase 和 Hibernate JPA 之间不兼容的序列名称

php - 全局登录(许多站点)

php - 将第一个数据库的一列复制到 MySQL 中的第二个数据库中

Eclipse(STS)+ Maven

maven-2 - Maven : How to check if an artifact exists?

java - Liquibase:如何在 EntityManager 构建之前执行 Servlet Listener

sql - 如何在记录中的子字符串上连接表?