如何使用kotlin DSL将系统属性传递给gradle测试
我正在尝试将系统属性传递给gradle测试。对于标准gradle,我会使用如何使用kotlin DSL将系统属性传递给gradle测试,gradle,gradle-kotlin-dsl,Gradle,Gradle Kotlin Dsl,我正在尝试将系统属性传递给gradle测试。对于标准gradle,我会使用 test { //... Other configurations ... systemProperties = System.properties } 使用kotlin DSL,将无法运行: tasks.withType<Test> { useJUnitPlatform() options { systemProperties(System.getProp
test {
//... Other configurations ...
systemProperties = System.properties
}
使用kotlin DSL,将无法运行:
tasks.withType<Test> {
useJUnitPlatform()
options {
systemProperties(System.getProperties())
}
}
有线索吗?谢谢。这对我很有用:
systemProperties = System.getProperties().map { e -> Pair(e.key as String, e.value) }.toMap()
要传递单个系统属性,请执行以下操作:
systemProperty("property.name", System.getProperty("property.name"))
这对我很有用:
systemProperties = System.getProperties().map { e -> Pair(e.key as String, e.value) }.toMap()
要传递单个系统属性,请执行以下操作:
systemProperty("property.name", System.getProperty("property.name"))