using Liquibase from Maven and command line failed

You should probably look into using either a Maven profile or overriding the property on the command line (using -D).


I want to update my database using a changeLogFile from Maven (during build/integrationTest) and command line (manual update/delete the database). This is currently (Liquibase 2.0.3) not possible due to the attribute ‘relativeToChangeLogFile’ of the xml element sqlFile. I use a changeSet with sqlFile for initially populating the database. The problem is, if I use Maven, this attribute has to set to ‘false’ but for use from command line, it has to be ‘true’. My project has the default maven web app directory layout and the liquibase-changesets.xml and the import.sql referring from xml-element sqlFile are in src/main/resources. The pom.xml is in the project root along with the script. If that script contains the liquibase calls directly 

  1. liquibase dropAll
  2. liquibase --changeLogFile=liquibase-postgresql-changelogs.xml update 

then I must switch ‘relativeToChangeLogFile’ from false to true everytime I want to start the script from the command line. My workaround is a second script in src/main/resources containing the liquibase calls mentioned above and calling that script from / but … you know … remember the DRY principle from the pragmatic programmers. Is there any other solution ?

Thanks in advance