javaspringspring-bootliquibase

Liquibase cannot find changelog file


I have following error with our spring boot 2 application:

Caused by: liquibase.exception.ChangeLogParseException: Error Reading Migration File: class path resource [src/main/resources/changelogs/changelog-1.0.xml] cannot be resolved to URL because it does not exist at liquibase.parser.core.xml.XMLChangeLogSAXParser.parseToNode(XMLChangeLogSAXParser.java:118) at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:15) at liquibase.changelog.DatabaseChangeLog.include(DatabaseChangeLog.java:525) at liquibase.changelog.DatabaseChangeLog.handleChildNode(DatabaseChangeLog.java:334) ... 190 common frames omitted

in application properties we have: spring.liquibase.change-log=classpath:/changelogs/changelog-master.xml

All scripts are structured in spring boot's resource folder /src/main/resources/changelogs

In changelogs fodler is master xml and changelog with changesets as well.

reference to changelog of changesets in master xml is like this:

<include file="src/main/resources/changelogs/changelog-1-0.xml"/>

I cannot find reason why this isn't work.

I tried relativeToChangelogFile="true" and in file use only file="changelog-1-0.xml" and this works, why ?


Solution

  • You should not include src/main/resouces in your path inside the master changelog; those directories are not reflected in the generated jar. Try just changelogs/changelog-1-0.xml.