includeAll includes just first xml

Description

We got a webapplication which is built up modular, so every modul can have some liquibase xmls:
Core Liquibase Module:
src/main/resources/com/project/liquibase/main.xml

Module1:
src/main/resources/com/project/liquibase/tables/tables_module1.xml
src/main/resources/com/project/liquibase/fks/fks_module1.xml

Module2:
src/main/resources/com/project/liquibase/tables/tables_module2.xml
src/main/resources/com/project/liquibase/fks/fks_module2.xml

main.xml

The problem is, Liquibase only includes the first Xml -> tables_module1.xml is included -> tables_module2.xml is not included.
It then fails executing fks_module1.xml because some tables are missing.
If i delete tables_module1.xml and restart the application, it actually finds tables_module2.xml in the classpath.
I really need this to be fixed, as we dynamically add modules (project dependent) and cannot hardcode the [ fk, tables ]_module.xml Files inside main.xml.

Environment

Win10 64bit
Spring
Tomcat

Attachments

1

Activity

Show:

MichaelW January 21, 2016 at 8:25 AM

Works as described. Nice !
Thank you!

Ryan Mahon January 20, 2016 at 11:18 PM

You can work around this by updating the spring config for the changeLog path to: liquibase.setChangeLog("classpath*:test/liquibase.xml");

Reason is that Spring's PathMatchingResourcePatternResolver.java expects "classpath*:" if you want multiple matches.

From file comments:

SpringLiquibase.java uses the path associated with the changeLog since relativeToChangelogFile="true". In your example this causes the "classpath:" to match only on the first resource found.

Hope this helps

MichaelW January 19, 2016 at 1:18 PM
Edited

Error still present. I built a small demo application which demonstrates the behaviour.
clone or check attachment: git clone https://bitbucket.org/MaffelBaffel/liquibase-test.git

Steps to reproduce:

  1. mvn install

  2. Edit server.properties so you have access to a database. We are using mssql, so i've got drivers already in dependencies. Server.properties is where Spring reads its Datasource Config, see LiquibaseConfig class

  3. check Module api resources: liquibase.xml includes <includeAll path='tables'> tag

  4. run Main.java in api Module, Liquibase runs only module1.xml, but not module2.xml !!!

  5. delete all tables

  6. comment the includeAll tag, uncomment both <include> tags in liquibase.xml

  7. rerun Main.java, Liquibase runs both, module1 and module2.xml

I have also included the liquibase maven plugin in the Api Module:

  1. again edit database configuration in api/pom.xml

  2. call update goal when includeAll tag in enabled -> both module xml's are executed

So i guess there is a error in Liquibase Spring integration.

Nathan Voxland November 24, 2015 at 10:19 PM

This appears to be working for me with the current 3.4.2 codebase. Possibly fixed by an earlier issue.

Details

Reporter

Components

Fix versions

Affects versions

Priority

Created November 15, 2015 at 12:23 PM
Updated January 21, 2016 at 8:25 AM