如何在 Gradle Liquibase 插件的 runList 字段中包含多个活动?

How do you include multiple activities in the Gradle Liquibase plugin's runList field?

我在 Mac Yosemite 和 Java 8 上使用 Gradle 2.7。我正在使用 Liquibase 1.1.1 插件并想使用它做一些活动(建立一个测试数据库和建立我的普通数据库)。所以我有

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-master.xml'
      url properties['url']
      username properties['username']
      password properties['password']
    }
    test {
        url 'jdbc:h2:file:target/testdb'
        username 'sa'
    }
    runList = (
        "test"
        "main"
    )
  }
}

但是我想不出 runList 的正确语法。当 运行 以上时我得到错误…

* Where:
Build file '/Users/myuser/Dropbox/cb_workspace/cbmyproject/build.gradle' line: 163

* What went wrong:
Could not compile build file '/Users/myuser/Dropbox/cb_workspace/cbmyproject/build.gradle'.
> startup failed:
  build file '/Users/myuser/Dropbox/cb_workspace/cbmyproject/build.gradle': 163: expecting ')', found 'main' @ line 163, column 2.
        "main"  
      ^

  1 error


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

根据其中一个示例,runList 必须放在 [ 之后=26=]块:

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-master.xml'
      url properties['url']
      username properties['username']
      password properties['password']
    }
    test {
        url 'jdbc:h2:file:target/testdb'
        username 'sa'
    }
  }

  runList = 'test, main'
}

参见示例 here

希望对您有所帮助。