Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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)
like image 562
mip Avatar asked May 20 '15 15:05

mip


1 Answers

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.

like image 87
mip Avatar answered Sep 22 '22 05:09

mip