java - 将参数传递给 gradle 构建脚本
问题描述
我正在尝试在控制台中执行这样的命令:
./gradlew cucumber -Pthreads=80 -Ptags=@ALL_API_TESTS
在 build.gradle 中:
cucumber {
threads = "$threads"
glue = 'classpath:com.sixtleasing.cucumber.steps'
plugin = ['pretty']
tags = "$tags"
featurePath = 'src/main/resources/feature'
main = 'cucumber.api.cli.Main'
}
但它不起作用:(我该如何解决?
解决方案
你的原始表达式将线程设置为一个String
值,当它显然是一个数字时,所以你需要使用类似的东西:
int threadsNum = "$threads".toInteger()
cucumber {
threads = threadsNum
glue = 'classpath:com.sixtleasing.cucumber.steps'
plugin = ['pretty']
tags = "$tags"
featurePath = 'src/main/resources/feature'
main = 'cucumber.api.cli.Main'
}
希望这可以帮助。
推荐阅读
- javascript - 无法使用 javscript 读取发布请求响应
- ios - JWPlayer - 点击播放解释为 iOS Safari/Chrome 上的自动播放
- python - 有没有办法以编程方式确认 python 包版本满足需求说明符?
- database - 当整个表被删除sql锁定时,oracle是否允许在表上选择
- c# - 不同情况下使用 DbSet 加入列表的最佳方式
- javascript - 如何在javascript中将数组更改为json对象
- datetime - 弹性搜索 2.0 嵌套 2.0 日期时间月搜索
- python - 使用多处理,如何在每个 CPU 内 Apply()
- android - 在 android 中,想要在 Firebase 中停止自动屏幕跟踪并使其自定义
- postgresql - 如何选择日期范围*和*该范围之前和之后的条目?