testing - 如何在 Gradle Liquibase 插件的 runList 字段中包含多个事件?

标签 testing plugins gradle liquibase

我在装有 Java 8 的 Mac Yosemite 上使用 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 必须放在 activity block 之后:

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 .

希望这对您有所帮助。

关于testing - 如何在 Gradle Liquibase 插件的 runList 字段中包含多个事件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33306302/

相关文章:

java - 升级到 gradle 插件 3.2.1 和 SDK 28 失败

javascript - 如何使用 practicalmeteor :mocha 对 meteor 方法进行单元测试

node.js - 在 Mocha 上测试管理员用户

python - 动态添加路线到 Pyramid

windows - 如何在 Windows 上查询插件 DLL 的体系结构

Android Studio - transformClassesWithMultidexlistForDebug 错误

unit-testing - 关于单元测试的几个问题

c# - 什么是 C# 测试驱动程序以及为什么要实现它

c++ - 设计器中自定义小部件的 QT QIcon 属性

android - 在新项目中以非零退出值 1 完成