在 gradle 中为 liquibase 更新任务设置自定义 .properties 文件

Set custom .properties file in gradle for liquibase update task

我将此任务用于 liquibase 更新:

task liquibaseUpdate(type: JavaExec) {
    description 'Liquibase updates DB by all not used changesets'
    group = 'Liquibase'
    classpath configurations.liquibase
    main = 'liquibase.integration.commandline.Main'
    if ( 
        project.hasProperty("username") &&
        project.hasProperty("password") &&
        project.hasProperty("url")
    ) {
        Map<String,?> propertyMap = project.getProperties()
        args "--username=${propertyMap['username']}"
        args "--password=${propertyMap['password']}"
        args "--url=${propertyMap['url']}"
    }
    args 'update'
}

它从 liquibase.properties 文件加载设置。如何使用自定义属性文件?

可能 --defaultsFile=</path/to/file> switch 就是您要找的。请看here.