I want to update my Spring Boot (2.7.x) project with liquibase version 4.9.1 to latest Spring Boot version (containing Liquibase 4.21.1).
Now I got following exception when booting up my system:
Caused by: liquibase.exception.ValidationFailedException: Validation was unsuccessful:
840 change sets had duplicate identifiers
That relates to the structure of my liquibase xml files: In order to define the dependencies within a multi-module project they are referencing each other:
# db/migration/changes/second.changelog.xml
...
<include file="/db/migration/changes/first.changelog.xml" />
...
Before the upgrade it worked well, now I get the exception above.
What I already tried:
Skipping the duplicate change set validation: I breakpointed in liquibase.changelog.visitor.ValidatingVisitor::validationPassed() and just returned true. Outcome was that the scripts are indeed executed twice and I get an SQL error, that tables already existed.
Removing the includes: That worked, I could resolve the duplications here, but then liquibase is not executing these files in the right order. Furthermore my itests broke because the dependencies of the scripts were missing.
Removing the includes and listing the changelogs explicitely inside of my db.changelog-master.yaml works. But this is not an option because I need to do same for intration tests and activating/deactivating single changelogs by spring profiles won't work with this "monolithic" configuration.
My question now: Has there been some new feature which handles duplicates differently? How can I fix the problem above?
It seems that the Liquibase-Team fixed a bug in 4.19.1. Currently there is a discussion if that should be a feature ;-)
https://github.com/liquibase/liquibase/issues/3881#issuecomment-1843935985
There will be a new flag in the newest version which enables this "feature" again:
-Dliquibase.allowDuplicatedChangesetIdentifiers=true
Until this is released, downgrading to 4.19.0 works for me.