JVM fork options for Gradle task test from Java plugin
I have two Gradle tasks with a test type (from Java Gradle):
task testsA(type: Test) {
useTestNG {
includeGroups 'typeA'
}
systemProperty 'hostname' 'localhost'
}
task testsB(type: Test) {
useTestNG {
includeGroups 'typeB'
}
systemProperty 'hostname' 'localhost'
}
This method systemProperty()
comes from a Java plugin and calls the systemProperty()
on object DefaultJavaForkOption
, which is private and final.
Is there a way to set the fork system property "hostname" once (in a different way or as a variable) and then use it in both of these tasks?
Note that I am not interested in defining the Gradle variable "hostname" and then reusing it as a value for the systemProperty method.
+3
source to share