liquibase / liquibase-gradle-plugin

A Gradle plugin for Liquibase
Other
200 stars 59 forks source link

unable to pass rollback parameters to gradle task #25

Closed Bahar13 closed 7 years ago

Bahar13 commented 7 years ago

When trying to pass the rollback parameters to a gradle task as suggested using -PliquibaseCommandValue, the task fails to find the parameter.

The gradle task is defined as below:

task liquibaseRollback(type: JavaExec) { group = "liquibase" classpath sourceSets.main.runtimeClasspath classpath configurations.liquibase main = "liquibase.integration.commandline.Main"

args "--changeLogFile=" + changeLogFile
args "--databaseChangeLogTableName=" + databaseChangeLogTableName
args "--databaseChangeLogLockTableName=" + databaseChangeLogLockTableName
args "--username=" + username
args "--password=" + password
args "--url=" + url
args "--driver=" + driverClassName
args "rollbackCount"

}

and trying to add -PliquibaseCommandValue='1' as the last line of the code or running this task from command line, like: gradle liquibaseRollback -PliquibaseCommandValue='1' is not working.

newnewcoder commented 7 years ago

How about use this plugin instead of defining a gradle task by JavaExec?

stevesaliman commented 7 years ago

@newnewcoder is correct. By defining your own task, you are not using the plugin. If your activities in the liquibase block of your build.gradle are correct, you should be able to execute gradle rollbackCount -PliquibaseCommandValue=1 to rollback one change.