Changelog with includeAll will not find child changelogs in Spring Boot's executable JAR
Description
Environment
Mac OS X 10.11.6
Activity
Show:
Nathan Voxland January 22, 2018 at 6:07 AM
Should be fixed with https://github.com/liquibase/liquibase/pull/698
Fred Puistaja May 2, 2017 at 8:01 AM
Same problem for me using Spring Boot v1.3.8 and Liquibase v3.5.3.
I downgraded to Liquibase 3.4.2 and everything works.
My changes are inside core.jar and I run application.jar
application.jar
├── lib
│ ├── core.jar
│ │ ├── liquibase
│ │ │ ├── changes
Robert Bor February 22, 2017 at 4:28 AM
@Einar - reading both of your linked issues, it certainly looks like they all have the same cause.
Einar Pehrson February 21, 2017 at 6:01 PM
I believe this is the same bug as https://liquibase.jira.com/browse/CORE-2863#icft=CORE-2863 and CORE-2876. See my comment on the former issue for more details.
Fixed
Details
Details
Reporter
Robert Bor
Robert BorComponents
Fix versions
Affects versions
Priority
Created November 22, 2016 at 6:45 PM
Updated January 22, 2018 at 6:07 AM
Resolved January 22, 2018 at 6:07 AM
Consider a Spring Boot project with a db/changelog.xml containing the includeAll element. If the project is packaged as an executable JAR, it will not be able find the related changelog files.
<includeAll path="changelogs" relativeToChangelogFile="true"/>
The resulting part of the log for liquibase
2016-11-22 19:41:56.135 INFO 29463 --- [ main] liquibase : Successfully acquired change log lock 2016-11-22 19:41:56.626 INFO 29463 --- [ main] liquibase : Creating database history table with name: PUBLIC.DATABASECHANGELOG 2016-11-22 19:41:56.628 INFO 29463 --- [ main] liquibase : Reading from PUBLIC.DATABASECHANGELOG 2016-11-22 19:41:56.631 INFO 29463 --- [ main] liquibase : Successfully released change log lock
Note that the specific changelog files are not run.
However, when the files are explicitly mentioned, they will be found:
<include file="classpath:db/changelogs/changelog_000.xml" relativeToChangelogFile="false"/>
2016-11-22 19:34:17.405 INFO 29362 --- [ main] liquibase : Successfully acquired change log lock 2016-11-22 19:34:17.889 INFO 29362 --- [ main] liquibase : Creating database history table with name: PUBLIC.DATABASECHANGELOG 2016-11-22 19:34:17.892 INFO 29362 --- [ main] liquibase : Reading from PUBLIC.DATABASECHANGELOG 2016-11-22 19:34:17.905 INFO 29362 --- [ main] liquibase : classpath:db/changelog.xml: classpath:db/changelogs/changelog_000.xml::1::some-author: Table domain created 2016-11-22 19:34:17.906 INFO 29362 --- [ main] liquibase : classpath:db/changelog.xml: classpath:db/changelogs/changelog_000.xml::1::some-author: ChangeSet classpath:db/changelogs/changelog_000.xml::1::some-author ran successfully in 7ms 2016-11-22 19:34:17.912 INFO 29362 --- [ main] liquibase : Successfully released change log lock
Note that the specific changelog files are now run.
The related StackOverflow issue: http://stackoverflow.com/questions/40729071/executable-jar-unable-to-find-liquibase-db-changelog-xml#answer-40731113
The entire project can be found here: https://github.com/robert-bor/executable-jar-with-liquibase