We're updating the issue view to help you get more done. 

Using includeAll with spring-boot packaged jars

Description

I am experiencing problems using the includeAll directive in the described environment. By investigating the problem I found a workaround and possibly a couple of bugs in liquibase classes.

I run programmatically the update with:

Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(connection));
Liquibase liquibase = new liquibase.Liquibase("db/liquibase-changelog.xml", new ClassLoaderResourceAccessor(), database);
liquibase.update(new Contexts(), new LabelExpression());

The file liquibase-changelog.xml is:

<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">

<includeAll path="changelog" relativeToChangelogFile="true"/>
</databaseChangeLog>

Update filess are inside folder db/changelog and don't get processed (they are actually packaged by spring boot under /BOOT-INF/classes/db/changelog).

I fixed the problem by using a custom ResourceAccessor in which I also had to rewrite the SpringBootFatJar.getSimplePathForResources method, which fails to remove the "/BOOT-INF/classes/" prefix in the DATABASECHANGELOG.FILENAME column due to a starting "/" present in the replace pattern but missing in the target string.

I am attaching the workaround class I am using, as it may contain hints for bugfixing in SpringBootFatJar and ClassLoaderResourceAccessor.

Environment

Jar packaged with spring boot, liquibase entries are inside BOOT-INF/classes.

Status

Assignee

Unassigned

Reporter

Alessandro Pira

Labels

None

Components

Affects versions

3.6.3

Priority

Minor