简体   繁体   中英

How do I use a Liquibase changelog which is in jar file

I currently have the following in my application.properties :

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

The actual path to the file is src/main/resources/db/changelog/db.changelog-master.xml .

The changelog is found by Liquibase and everything is working as I would expect.

I've moved the changelog and all of the project's JPA entities and repositories into a separate project so that they can be shared with other projects.

This second project is a Maven dependency of the first project. What path do I need to use in application.properties of the first project to access the liquibase changelog in the second project?

Update

I have:

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

But I'm getting:

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)

I'm an idiot. My local ~/.m2 repository had an old version of the jar without the Liquibase changelog. A mvn clean install fixed the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM