내 앱에는 테스트 할 위치가 필요합니다. 이 속성은 시스템 속성을 통해 전달됩니다.명령 줄에서 내 앱에 gradle을 통해 시스템 속성 전달
명령 행에서 실행하는 경우가 Gradle을이 값에 전달하지 않습니다 :
./gradlew -Dfoo=bar clean cucumber
자바 코드 :
System.out.println("**foo(props):"+ System.getProperty("foo"));
출력 : 내가했습니다
**foo(props):null
이 here에 대한 몇 가지 문서를 본 적이 있지만, 내 gradled 스크립트에서 사용하려고하면 다음과 같은 오류가 발생합니다. R :
여기Creating properties on demand (a.k.a. dynamic properties) has been deprecated and is scheduled to be removed in Gradle 2.0. Please read http://gradle.org/docs/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html 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을 통해 응용 프로그램에 시스템 속성을 통과합니까?