Gradle:作为正常构建过程的一部分,我如何运行LIquibase变更集?
我正在使用Gradle2.7和GradleLiquibase插件V1.1.1。如何使用Gradle:作为正常构建过程的一部分,我如何运行LIquibase变更集?,gradle,build,liquibase,changeset,Gradle,Build,Liquibase,Changeset,我正在使用Gradle2.7和GradleLiquibase插件V1.1.1。如何使用 gradle build ??我目前在build.gradle文件中有这个 liquibase { activities { main { File propsFile = new File("${project.rootDir}/src/main/resources/liquibase.properties") Properties properties = new
gradle build
??我目前在build.gradle文件中有这个
liquibase {
activities {
main {
File propsFile = new File("${project.rootDir}/src/main/resources/liquibase.properties")
Properties properties = new Properties()
properties.load(new FileInputStream(propsFile))
changeLogFile 'src/main/resources/db.changelog-1.0.xmlll'
url '${url}'
username '${username}'
password '${password}'
}
runList = main
}
}
但是,当我运行上面的命令(“gradlebuild”)时,上面的命令不会运行。我知道它没有运行,因为用户名/密码不正确,并且我没有以“.xmll”结尾的更改日志文件。我还需要添加什么来确保hte插件始终尝试执行变更集 您需要定义从生成到更新的任务依赖关系
build.dependsOn update
要使任务在测试之前运行(假设未定义新任务),可以执行以下操作
test.dependsOn update
参考:
apply plugin: 'liquibase'
dependencies {
classpath 'org.liquibase:liquibase-gradle-plugin:1.2.0'
}
liquibase {
activities {
main {
changeLogFile 'changelog.xml'
url 'jdbc:h2:db/liquibase_workshop;FILE_LOCK=NO'
username 'sa'
password ''
}
}
然后运行此命令gradle update如何在运行测试之前让任务运行?