java中gradlew 命令_java-通过gradle将系统属性从命令行传递到我...

我的应用程序需要一个测试位置.我想通过系统属性来传递它.

在命令行上运行时,gradle不会传递该值:

./gradlew -Dfoo=bar clean cucumber

Java代码:

System.out.println("**foo(props):"+ System.getProperty("foo"));

输出:

**foo(props):null

我已经看过一些关于here的文档,但是当我尝试在gradle脚本中使用它时,出现以下错误:

Creating properties on demand (a.k.a. dynamic properties) has been deprecated and is scheduled to be removed in Gradle 2.0. Please read 07001 for information on the replacement for dynamic properties.

Deprecated dynamic property: “systemProperties” on “task ‘:cucumber'”, value: “{jna.platform.library….”.

这是我的build.gradle的片段:

task cucumber() {

dependsOn assemble, compileTestJava

doLast {

systemProperties = System.getProperties()

javaexec {

main = "cucumber.api.cli.Main"

classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output

args = ['-f', 'pretty', '--glue', 'steps', 'src/test/resources']

}

}

}

如何通过Gradle将系统属性传递给应用程序?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值