ybondar
ybondar

Reputation: 409

Liquibase executes changeset several times in single Maven build

I am observing some strange Liquibase behavior when I run simple Maven project on TeamCity build agent.

Maven project structure:

changelogs/
databaseChangeLog.xml
pom.xml

Run command: mvn liquibase:update

databaseChangeLogs.xml contains next line: <includeAll path="changelogs/"/>

But build log contains duplication records:

liquibase: databaseChangeLog.xml: /home/teamcity/BuildAgent/work/28fe713da351c06d/changelogs/1.xml: ChangeSet /home/teamcity/BuildAgent/work/28fe713da351c06d/changelogs/1.xml ran successfully in 40ms

liquibase: databaseChangeLog.xml:  Custom SQL executed
liquibase: databaseChangeLog.xml: changelogs/1.xml: ChangeSet changelogs/1.xml ran successfully in 36ms

So seems like Liquibase picked up changeset twice from different locations: from build agent's build folder and root of the project.

Does anybody meet the same issue? Any ideas how to fix this?

Upvotes: 4

Views: 1046

Answers (1)

srz
srz

Reputation: 183

Liquibase has kinda a design flaw which lays in considering at our first glance "identical" change sets as different. To bypass such a peculiarity you can use logicalFilePath attribute either on databaseChangeLog tag or on every changeSet tag. This one will add another level of identity, uniqueness to a your change set.

Upvotes: 5

Related Questions