I'm unable to get liquibase migration working with Spring Boot when I'm deploying the app in a docker container. I have a fat jar which is extracted when the docker image is created.
I have a separate module where I keep my migration files. I am able to load the master.xml:
<includeAll path="classpath*:/changelog" relativeToChangelogFile="false" />
It then goes on and loads the rest of the resources. The problem is that SpringResourceOpener.java
then extracts the real path from loaded resources which is still ok:
jar:file:/app/lib/database-0.0.1-SNAPSHOT.jar!/changelog/001-categories-table.xml
But then does some path manipulations which ends up with:
lib/database-0.0.1-SNAPSHOT.jar/changelog/001-categories-table.xml
Which in turn is not a valid classpath path:
Caused by: java.io.FileNotFoundException: class path resource
[lib/database-0.0.1-SNAPSHOT.jar/changelog/001-categories-table.xml]
cannot be resolved to URL because it does not exist
I either need the /changelog/001-categories-table.xml
(classpath) or file:/app/lib/database-0.0.1-SNAPSHOT.jar!/changelog/001-categories-table.xml
to be able to read the file. But it always ends up the incomplete path as above.
Is this a configuration issue or there is a way to tweak this behaviour?