tlberglund/gradle-liquibase-plugin

parameters of commands must be added at the end of args

Closed this issue · 1 comments

using version 0.7

>gradle -Dliquibase.count='1' rollback

doesn't work.

As I can see in LiquibasePlugin.groovy the value of "liquibase.count" is added as an option.

...
      if(System.properties['liquibase.count']) {
        command = 'rollbackCount'
        options = [ System.properties['liquibase.count'] ]
      }
...

but it has to be a parameter after the command. Documentation of command line says:

...
Usage: java -jar liquibase.jar [options] [command]
...
rollback <tag> ...

A possible implementation will be:

...
      if(System.properties['liquibase.count']) {
        command = 'rollbackCount'
        parameter = [ System.properties['liquibase.count'] ]
      }
...

and then in LiquibaseBaseTask.groovy something like this:

...
      if (options) {
        args += options
      }

      if(command) {
        args += command
      }

      if(parameter) {
        args += parameter
      }

      Main.main(args as String[])
...

This should be working now as of version 1.0.0. Note the groupId change in the maven repository.