Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maven plugin ignores changeLogDirectory, finds two changelog files #3282

Closed
marcelstoer opened this issue Sep 19, 2022 · 0 comments · Fixed by #3347
Closed

Maven plugin ignores changeLogDirectory, finds two changelog files #3282

marcelstoer opened this issue Sep 19, 2022 · 0 comments · Fixed by #3347

Comments

@marcelstoer
Copy link

Environment

Liquibase Version: 4.9.1

Liquibase Integration & Version: Maven

Database Vendor & Version: I tested with Postgres and Oracle

Operating System Type & Version: I tested on macOS and Linux

Description

I appears as if the Maven plugin ignores its changeLogDirectory parameter or gives precedence to the classpath. The consequence is that it finds the changelog file selected through the changeLogFile parameter in two places.

Steps To Reproduce

  • Prepare a database of choice e.g. Postgres.
  • Use basic Maven project structure.
  • Place a changelog file db/changelog/db.changelog-master.xml in src/main/resources.
  • Run a Maven build e.g. mvn package. Maven will copy all resources to target/classes.
  • Run Liquibase through Maven
mvn org.liquibase:liquibase-maven-plugin:4.9.1:update \
-Dliquibase.changeLogFile="db/changelog/db.changelog-master.xml" \
-Dliquibase.changeLogDirectory="src/main/resources" \
-Dliquibase.driver=org.postgresql.Driver \
...

Actual Behavior

Liquibase scans the classpath for the configured changelog file and finds it in two places:

[ERROR] Error Reading Changelog File: Found 2 files that match db/changelog/db.changelog-master.xml:
file:/some-dir/target/classes/db/changelog/db.changelog-master.xml,
file:/some-dir/src/main/resources/db/changelog/db.changelog-master.xml

Expected/Desired Behavior

Since I explicitly set -Dliquibase.changeLogDirectory="src/main/resources" Liquibase should only look in src/main/resources in which case it would not find two changelog files.

Additional Context

Several other issues were reported about such behavior but none specific to Maven e.g. #2818. Their potential fix through #3119 does not apply here as the changelog folder is defined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment