I have a a Java program which reads a System property
System.getProperty(\"cassandra.ip\");
and I have a Gradle build file that I start wit
I had a case where I needed to pass multiple system properties into the test JVM but not all (didn't want to pass in irrelevant ones). Based on the above answers, and by using subMap
to filter the ones I needed, this worked for me:
task integrationTest(type: Test) {
// ... Do stuff here ...
systemProperties System.getProperties().subMap(['PROP1', 'PROP2'])
}
In this example, only PROP1
and PROP2
will be passed in, if they exist in gradle's JVM.