首页 文章

如何使用jar文件中的Liquibase更改日志

提问于
浏览
6

我目前在 application.properties 中有以下内容:

liquibase.change-log=classpath:/db/changelog/db.changelog-master.xml

该文件的实际路径是 src/main/resources/db/changelog/db.changelog-master.xml .

更改日志是由Liquibase发现的,一切都按照我的预期运作 .

我已将更改日志和项目的所有JPA实体和存储库移动到一个单独的项目中,以便可以与其他项目共享 .

第二个项目是第一个项目的Maven依赖项 . 在第一个项目的 application.properties 中需要使用哪条路径才能访问第二个项目中的liquibase changelog?

Update

我有:

projectA.jar - > pom.xml

<dependency>
    <groupId>com.foo</groupId>
    <artifactId>projectB</artifactId>
    <version>0.0.1-SNAPSHOT</version>
</dependency>

projectA.jar - > application.properties

liquibase.change-log=classpath:/db/changelog/db.changelog-master.xml

projectB.jar - > src / main / resources / db / changelog / db.changelog-master.xml

但是我得到了:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration$LiquibaseConfiguration': Invocation of init method failed; nested exception is java.lang.IllegalStateException: Cannot find changelog location: class path resource [db/changelog/db.changelog-master.xml] (please add changelog or check your Liquibase configuration)

1 回答

  • 3

    我是个白痴 . 我的本地 ~/.m2 存储库有一个旧版本的 jar ,没有Liquibase更改日志 . 一个 mvn clean install 解决了这个问题 .

相关问题