liquibase使用maven与两个数据库 [英] liquibase using maven with two databases

查看:114
本文介绍了liquibase使用maven与两个数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

i have the following structure to run one database from 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的另一个数据库。我试过这个:

now i want to run another database in the same server with the name charm2. i tried this:

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

它不工作。有没有人知道如何解决这个问题?

and it does not work. does anyone know how to solve this?

推荐答案

也许你可以尝试给一个< id& / code>给每个< execution> 。像

Perhaps you could try giving an <id> to each <execution>. Something like

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

如果这不起作用, stacktrace指定maven无法验证pom的确切行。

If this does not work, you could update your question with the full stacktrace specifying the exact line that maven fails to validate the pom.

这篇关于liquibase使用maven与两个数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆