There is no direct way to set JVM options for a GradleWorkerMain
process. Most (but not all) task types that fork new workers implement JavaForkOptions
, so you could try:
tasks.withType(JavaForkOptions) {
systemProperty "cool.opt", "1"
jvmArgs "someArg"
}
Task types that don't implement JavaForkOptions
typically allow to set fork options in some other way. For example:
tasks.withType(JavaCompile) {
options.fork = true // otherwise won't fork
options.forkOptions.jvmArgs = ["-Dcool.opt=1"]
}