Jmix 2.0 composite project includeAll tag seems to have no effect

Hi,
In Jmix 2.0 composite project
Add-on with liquibase includeAll tag seems not work

  • but using the include tag instead seems to work correctly.

Here is the Steps

  1. Create composite project with 2 add-ons: core, organization
    image

  2. organization depends on core
    image

  3. core add-on add an new entity > recreate DB > auto generate 20-142653-42234524.xml
    default using includeAll tag
    image

  4. go to organization add-on > recreate DB
    image

  5. core’s liquidbase change log (20-142653-42234524.xml) is not being executed.
    image

  6. change core’s changelog from includeAll to include
    image

  7. go to organization add-on > recreate DB
    image

  8. core’s liquidbase change log (20-142653-42234524.xml) is being executed.
    image

Please help me to clear up this confusion.

best regards,
Shengpo

Hi,
If you run it from your addon “Main” instead, I believe it will generate/execute for all add-ons.

Hi,
I still have a question.
In my case, I want each addon to have its entity changelogs instead of only the “Main changelog”.

Hi

Thanks for reporting the issue.
I have reproduced such behavior even for standalone add-on project (not composite project). Changelogs from dependencies not being executed.

YouTrack issue created.

1 Like

OKOK! Thanks a lot. :grinning:

Hi

Invesigation of the issue shown that it is caused by Liquibase version upgrade in Jmix 2.0.
The problem can be solved by modifying includeAll tag in add-on root changelog.

<includeAll path="/com/company/core/liquibase/changelog"/>
should be changed to
<includeAll path="/changelog" relativeToChangelogFile="true"/>

Changelog generation in Studio will be fixed in the next release, but for existing project this should be done manually.

1 Like

Hi, @gaslov

Modify changelog.xml as per the method you suggested.
Test on the composite project.
Changelog scripts are generated successfully for add-ons.
However, an error occurs when recreating the DB for the main-app.

Starting Liquibase at 16:42:53 (version 4.20.0 #7837 built at 2023-03-07 16:25+0000)
[2023-08-09 16:42:54] INFO [liquibase.database] Set default schema name to PUBLIC
[2023-08-09 16:42:54] INFO [liquibase.changelog] Reading resource: com/company/core/liquibase/changelog/2023/07/24-142653-42234524.xml
[2023-08-09 16:42:54] INFO [liquibase.changelog] Reading resource: com/company/core/liquibase/changelog/2023/07/24-142653-42234524.xml
[2023-08-09 16:42:54] INFO [liquibase.changelog] Reading resource: com/company/organization/liquibase/changelog/2023/08/09-153809-42234524.xml
[2023-08-09 16:42:54] INFO [liquibase.changelog] Reading resource: com/company/main/liquibase/changelog/010-init-user.xml
[2023-08-09 16:42:54] INFO [liquibase.changelog] Change failed validation!
Unexpected error running Liquibase: Validation Failed:
     1 changesets had duplicate identifiers
          com/company/core/liquibase/changelog/2023/07/24-142653-42234524.xml::1::core

For more information, please use the --logLevel flag
[2023-08-09 16:42:55] SEVERE [liquibase.integration] Unexpected error running Liquibase: Validation Failed:
     1 changesets had duplicate identifiers
          com/company/core/liquibase/changelog/2023/07/24-142653-42234524.xml::1::core

liquibase.exception.ValidationFailedException: Validation Failed:
     1 changesets had duplicate identifiers
          com/company/core/liquibase/changelog/2023/07/24-142653-42234524.xml::1::core

	at liquibase.changelog.DatabaseChangeLog.validate(DatabaseChangeLog.java:357)
	at liquibase.Liquibase$16.run(Liquibase.java:2296)
	at liquibase.Scope.lambda$child$0(Scope.java:187)
	at liquibase.Scope.child(Scope.java:196)
	at liquibase.Scope.child(Scope.java:186)
	at liquibase.Scope.child(Scope.java:165)
	at liquibase.Liquibase.runInScope(Liquibase.java:2639)
	at liquibase.Liquibase.listUnrunChangeSets(Liquibase.java:2286)
	at liquibase.Liquibase.isUpToDateFastCheck(Liquibase.java:506)
	at liquibase.Liquibase.lambda$update$1(Liquibase.java:237)
	at liquibase.Scope.lambda$child$0(Scope.java:187)
	at liquibase.Scope.child(Scope.java:196)
	at liquibase.Scope.child(Scope.java:186)
	at liquibase.Scope.child(Scope.java:165)
	at liquibase.Liquibase.runInScope(Liquibase.java:2639)
	at liquibase.Liquibase.update(Liquibase.java:236)
	at liquibase.Liquibase.update(Liquibase.java:221)
	at liquibase.integration.commandline.Main.lambda$doMigration$1(Main.java:1757)
	at liquibase.Scope.lambda$child$0(Scope.java:187)
	at liquibase.Scope.child(Scope.java:196)
	at liquibase.Scope.child(Scope.java:186)
	at liquibase.Scope.child(Scope.java:165)
	at liquibase.integration.commandline.Main.doMigration(Main.java:1756)
	at liquibase.integration.commandline.Main$1.lambda$run$0(Main.java:415)
	at liquibase.Scope.lambda$child$0(Scope.java:187)
	at liquibase.Scope.child(Scope.java:196)
	at liquibase.Scope.child(Scope.java:186)
	at liquibase.Scope.child(Scope.java:165)
	at liquibase.integration.commandline.Main$1.run(Main.java:414)
	at liquibase.integration.commandline.Main$1.run(Main.java:231)
	at liquibase.Scope.child(Scope.java:196)
	at liquibase.Scope.child(Scope.java:172)
	at liquibase.integration.commandline.Main.run(Main.java:231)
	at liquibase.integration.commandline.Main.main(Main.java:173)

Hi

There is another issue from Liquibase when using includeAll tag in dependencies.
You get this “changesets had duplicate identifiers” if changelog.xml file from transitive dependency explicitly included to your main changelog.

E.g. for composite project above with core, organization add-ons and main app. If you have organization depending on core and main depending on organization adding core changelog to the main changelog.xml is not needed, because it will be added transitively from organization add-on. If added, the error you provided occurs.

Unfortunately Studio erroneously suggests to add this include. This will be fixed in the next release.

To fix the problem, check main app changelog and remove include of core add-on changelog.

1 Like