Is it possible to merge `org.gradle.jvmargs` flags?

I have some projects that define in their gradle.properties some keys like

org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 \
  -XX:+IgnoreUnrecognizedVMOptions \
  --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
  --add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED \
  --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
  --add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
  --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
  --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED

However, I would like to set a few JVM options to the daemon globally, e.g.org.gradle.jvmargs = -XX:+IgnoreUnrecognizedVMOptions -XX:+UseParallelGC.

Due to the prioritization mechanism the value that is picked is the one from $HOME/.gradle/gradle.properties over the keys from the project.

While this prioritization can make a lot of sense for most properties. Some properties could act as collection, and may benefit from a behavior that merge items of these properties.

I have no good UX at this time to suggest. However I wonder if this behavior is achievable by other means ?

Not that I’m aware of, besides a custom wrapper implementation.

1 Like

Ah too bad, thank you for the confirmation though.

1 Like