Liquibase changeset filename format differences between WAR deployment on application server and Gradle Plugin in Eclipse

Viewed 553

Folks,

I'm currently working on an application which makes use of Liquibase 3.4.2. We use Eclipse as our primary IDE, and during development we also use the Liquibase Gradle Plugin [1.2.1] to test new changesets etc. However, one of the things that we've noticed is that depending on how changesets are applied, the format of the changeset 'filename' in DATABASECHANGELOG is different.

For example, in our production environment, we deploy our application as a WAR file on Tomcat 7 - new changesets are added to the DATABASECHANGELOG table with a filename in the format:

classpath:path/to/changeset.xml (e.g. classpath:configuration/liquibase/db-changelog-1.0.xml)

However, if we attempt to apply changesets using the Liquibase plugin 'update' task in Gradle, the classpath: prefix is replaced with the fully qualified classpath, e.g.:

src/main/resources/configuration/liquibase/db-changelog-1.0.xml

This is not normally an issue, however if I decide to take a recent dump of data from our production environment (which contains changeset filenames with the classpath: prefix) so that I can test new changesets on my development environment (where I use the Gradle plugin) I hit a problem because Liquibase will try to re-apply existing changesets because the id/author/filename combination that it is looking for will not exist in the database. I can get around the problem by temporarily updating all the filename values in my development environment to match the format that the Liquibase Gradle plugin is expecting, but I was wondering if there is some way to control this behaviour through plugin configuration so that Liquibase generates the same changeset filename format regardless of deployment method

I am aware of the Liquibase logicalFilePath attribute which I could use to generate consistent, environment agnostic changeset filenames - but I just wanted to explore the possibility that there may be some way to control this behaviour through plugin/liquibase configuration first.

For reference, here's the relevant segment of our build.gradle file:

liquibase
{
  activities
  {
    main
    {
      changeLogFile 'src/main/resources/configuration/liquibase/db-changelog-master.xml'
      url 'jdbc:mysql://host:port/myappdb'
      username 'XXX'
      password 'YYY'
      classpath '$rootDir'
    }
  }

  runList = 'main'
}

Any ideas?

0 Answers
Related