Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to set duplicateFileMode property in application.yaml for liquibase

I have a Java project with Liquibase library as database migration tool. When running migrations I'm facing the issue: "Found 2 files with the path 'db/changelog/db.changelog-master.yaml'" and a suggestion how to fix that: "You can limit the search path to remove duplicates with the liquibase.searchPath setting. Or, if you KNOW these are the exact same file you can set liquibase.duplicateFileMode=WARN."

I am able to set the property via static block like:

static {
      System.setProperty("liquibase.duplicateFileMode", "WARN");
    }

And that works fine. However, based on liquibase documentation, this should we set as Java property as well, I suppose this value should be set from application.yaml like this:

spring:
  liquibase:
    parameters:
      duplicate-file-mode: WARN

or

spring:
  liquibase:
    parameters:
      duplicateFileMode: WARN

The application fails with the initial error: "Found 2 files with the path 'db/changelog/db.changelog-master.yaml'"

like image 387
Roman Sobo Avatar asked Sep 20 '25 04:09

Roman Sobo


2 Answers

Other walkaround may be to apply this env variable in gradle

I added configuration to my build.gradle.kts:

  tasks.withType<Test> {
    environment("LIQUIBASE_DUPLICATE_FILE_MODE", "WARN") // because of bug: https://stackoverflow.com/questions/77301370/unable-to-set-duplicatefilemode-property-in-application-yaml-for-liquibase
  }

EDIT:

Does not work for all versions of liquibase-core

  • didn't work for 4.17.1, worked fine for 4.20.0
like image 67
Maciej Nawrocki Avatar answered Sep 22 '25 17:09

Maciej Nawrocki


That's an open issue in Liquibase project. Link to follow https://github.com/liquibase/liquibase/issues/3230

like image 22
Roman Sobo Avatar answered Sep 22 '25 17:09

Roman Sobo