Passing jvm arguments to Gradle test task

梦想与她 提交于 2019-12-11 07:39:28

问题


I would like to pass JVM parameters to my Gradle test task. I use the parameters in a Cucumber feature file: ${app.url}. In the build.gradle file, I put those lines:

test {
    testLogging.showStandardStreams = true
    systemProperties System.getProperties()
}

When I execute gradle test -Dapp.url=http://....., I don't see the parameter was passed to the application. I also tried the below, but the result is the same:

test {
    testLogging.showStandardStreams = true
    systemProperty "app.url", System.getProperty("app.url")
}

When I use Maven and pass the same parameters as Jvm arguments, it works fine. Now I would like to switch to the Gradle, but I am stuck with passing parameters.


回答1:


gradle is having -P or --project-prop option. Try this one and see.

-P, --project-prop Set project property for the build script



来源:https://stackoverflow.com/questions/44776319/passing-jvm-arguments-to-gradle-test-task

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!