I’m trying to debug some very strange behavior I’m seeing in Jenkins, which I cannot reproduce interactively.
I start Gradle using something like ./gradlew --gradle-user-home ./.gradle
. I assume Gradle using the desired .gradle
directory, because it shows:
Initialized native services in: /jenkins-workspace/.gradle/native
I see a daemon being started, but the jar for the daemon is coming from the user home directory:
Starting process ‘Gradle build daemon’. Working directory: /jenkins-workspace/.gradle/daemon/7.5.1 Command: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.392.b08-2.el7_9.x86_64/bin/java -XX:MaxMetaspaceSize=256m -XX:+HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=US-ASCII -Duser.country=US -Duser.language=en -Duser.variant -cp /home/jenkins-user/.gradle/wrapper/dists/gradle-7.5.1/bjcbri4bx7kucownmc612jwbq/gradle-7.5.1/lib/gradle-launcher-7.5.1.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 7.5.1
I also run with --no-daemon
, to ensure that a daemon is always being started and that it doesn’t try to connect to something that already exists.
If I run the same command on my machine, I see the wrapper being downloaded in /invocation-directory/.gradle/wrapper
. This is what I would expect, that the location of the wrapper is GRADLE_USER_HOME/wrapper
(in this case ./.gradle/wrapper
).
The wrapper properties file is “default”:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Neither of the GRADLE_USER_HOME
, GRADLE_HOME
, GRADLE_OPTS
or JAVA_OPTS
variables are set in the Jenkins job. I also tried using --debug
to see if I get more insights, but nothing is really printed regarding wrapper location. How can I go about debugging this?