How to pass system properties to Gradle daemon?


(Yi Cheng) #1

Hi,

I am trying to pass system properties into daemon, so we can tag them with their original workspace for better management in CI.

However, I tried the following but it seems daemon did not pick up the tag.

$ ./gradlew -Dorg.gradle.jvmargs="-Xms2g -Xmx8g -Ddaemon.tag=123"

$ ps -ef | grep gradle
  501 94927     1   0  1:21PM ??         0:32.20 /usr/bin/java -Xms2g -Xmx8g -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -cp /Users/user/.gradle/wrapper/dists/gradle-4.8.1-bin/e8p42vx1m7a3mz9ydmjagn6wn/gradle-4.8.1/lib/gradle-launcher-4.8.1.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 4.8.1

-Xms2g -Xmx8g is passed to daemon, but not -Ddaemon.tag=123 (edited)

Is it the case that gradle will fill out some the system args. Please kindly advice we may proceed.

Thanks!


(Stefan Oehme) #2

Only immutable system properties (e.g. file.encoding) are passed at startup. All the others are passed as arguments of the build, since they are not relevant for daemon compatibility.

The daemon is not bound to a workspace. It can be reused by many builds.