Gradle Script parameters not being passed along

My gradle build scripts by default have org.parallel=true defined in the gradle.properties file. This makes the builds execute faster in parallel mode. However there are a few tasks which don't work properly if run in parallel mode. I've typically handled this by adding -Dorg.gradle.properties=false on the command line when invoking those specific tasks. This always works just fine.

However I'm having a problem with my run configurations not passing this parameter to gradlew when launching my task from Intellij/AS. If I add -D.org.gradle.parallel=false as a script parameter for a Gradle run config the script param is ignored, and gradlew launches in parallel mode, the banner message comes up that says Parallel Execution is a feature still in incubation.

Any idea what is wrong or how to get Intellij/AS to pass this parameter to gradlew?

Thanks, Derek

1 comment
Comment actions Permalink

Hi Derek,

If you want to pass java system properties to gradle use "VM options" field of the Gradle run configuration.
'Script parameters' field can be used to pass gradle command line options like --info, --parallel, see more at https://docs.gradle.org/current/userguide/gradle_command_line.html (note, not all of them supported when gradle daemon used and hence in IDEs)

Unfortunately, when you pass -Dorg.gradle.parallel as a system parameter tru gradle tooling api (using IDEA gradle run configuration in this case), it's not honored by gradle like it does for CLI invocation.
It's not clear why, e.g. if you pass -Dorg.gradle.parallel=true in "VM options" field and write the following code somewhere in your *.gradle scripts:

println "org.gradle.parallel: " + System.getProperty('org.gradle.parallel')

 
org.gradle.parallel: true
0

Please sign in to leave a comment.