liquibase integration not interoperable between command line and application

429 Views Asked by At

I'm using liquibase since several years and it's extremly helpful for me as application developer to bring source code and database in sync, so thank you to all contributors for this tool.

During my daily work, I usually start liquibase from the command line in order to test the changesets and database operations. If everything is wired right, I start my application (Spring Boot) and the liquibase setup within the application performs all those sync steps. These setup works perfect unless my changelog file contains changesets with loaddata in order to populate data from CSV files into the database. Every application start fails with liquibase.exception.ValidationFailedException: Validation Failed: change sets check sum

The reason seems to be the different file locations for the CVS files mentioned in loaddata which are part of the checksum computation. If startet from the application, the changesets looks like this:

classpath:liquibase/changelog.xml: classpath:liquibase/changelog.xml::loadDefaultRolePermissions::dominik

But if started from commandline, there is no way to use classpath resources, the changeset infos looks like that

liquibase: src/main/resources/liquibase/changelog.xml: src/main/resources/liquibase/changelog.xml::loadDefaultRolePermissions::dominik

Both values differs and leads to different checksums.

If you look into liquibase.integration.commandline.Main.java, there is no classpath resource accessor used:

FileSystemResourceAccessor fsOpener = new FileSystemResourceAccessor();
CommandLineResourceAccessor clOpener = new CommandLineResourceAccessor(classLoader);
CompositeResourceAccessor fileOpener = new CompositeResourceAccessor(fsOpener, clOpener);

from liquibase.integration.commandline.Main.java

Is there any way to let liquibase be interoperable between command line AND application startup run ?

Thanks in advance
Dominik

1

There are 1 best solutions below

0
On BEST ANSWER

RESOLVED by updating from liquibase 3.3.1 to 3.5.3