给定:
1. Java 中有两个项目。首先是应用程序的业务逻辑。第二个是第一个应用程序中使用的数据模型类。它还包含 changeLog.xml 迁移脚本。
第一个应用程序包含对第二个应用程序的依赖并使用它的类。
2. 我们将 liquibase-maven-plugin 连接到第一个应用程序:
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<configuration>
**<changeLogFile>
???
</changeLogFile>**
<driver>com.mysql.jdbc.Driver</driver>
<url>jdbc:mysql://${mysql.host}:${mysql.port}/${mysql.db}</url>
<username>${mysql.login}</username>
<password>${mysql.password}</password>
</configuration>
</plugin>
如何从changeLogFile中的依赖库中指定changeLog.xml的路径?
Liquibase 在第二个项目的 src/main/resource/db
使用配置文件会更方便,应该放在pom.xml旁边
例如,一个属性文件可能如下所示:
在 Idea 中按配置前滚更改
解决方案原来是这样的:为了让业务逻辑项目中安装的liquibase插件能够访问数据模型项目中的changeLog.xml,需要将其添加到插件依赖中: