liquibase 使用 Maven 和两个数据库

发布于 2024-10-15 11:14:22 字数 2892 浏览 2 评论 0原文

我有以下结构来从 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>

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

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>

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

云裳 2024-10-22 11:14:22

也许您可以尝试为每个 提供一个 。 如果这不起作用

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

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

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

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文