Gradle daemon is not happy, if your JDK home is actually a symlink to some remote location and reported following error:
My gradle.properties have following entry:
org.gradle.java.home=/usr/local/packages/jdk7
$ ./gradlew clean
Starting a new Gradle Daemon for this build (subsequent builds will be faster).
FAILURE: Build failed with an exception.
- What went wrong:
The newly created daemon process has a different context than expected.
It won’t be possible to reconnect to this daemon. Context mismatch:
Java home is different.
Wanted: DefaultDaemonContext[uid=null,javaHome=/usr/local/packages/jdk7,daemonRegistryDir=/scratch/cvaishna/gradle_user_home/daemon,pid=1379 7,idleTimeout=null,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser. language=en,-Duser.variant]
Actual: DefaultDaemonContext[uid=af4c818c-ccf2-4b5b-917d-1c08f937114f,javaHome=/ade_autofs/gd29_3rdparty/nfsdo_generic/JDK7/MAIN/LINUX.X64/1 50608.1.7.0.85.0B015/jdk7,daemonRegistryDir=/scratch/cvaishna/gradle_user_home/daemon,pid=13849,idleTimeout=10800000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]
This is how my JDK is setup:
$ ls -ld /usr/local/packages/jdk7
lrwxrwxrwx 1 root root 61 Jul 25 2013 /usr/local/packages/jdk7 -> /ade_autofs/gd29_3rdparty/JDK7_MAIN_LINUX.X64.rdd/LATEST/jdk7
$ readlink /usr/local/packages/jdk7
/ade_autofs/gd29_3rdparty/JDK7_MAIN_LINUX.X64.rdd/LATEST/jdk7
$ ls -ld /ade_autofs/gd29_3rdparty/JDK7_MAIN_LINUX.X64.rdd/LATEST
lrwxrwxrwx 1 stvobadm svrtech 21 Jul 14 13:15 /ade_autofs/gd29_3rdparty/JDK7_MAIN_LINUX.X64.rdd/LATEST -> 150608.1.7.0.85.0B015
You say the link is pointing to a “remote” location. I take it this is an NFS mounted filesystem?
Yes, ’ /usr/local/packages/jdk7’ points to a NFS mounted location.
But ‘/usr/local/packages/jdk7’ & ‘/ade_autofs/gd29_3rdparty/nfsdo_generic/JDK7/MAIN/LINUX.X64/150608.1.7.0.85.0B015/jdk7’ are actually the same JDK location.
If you try to get the absolute path of ‘/usr/local/packages/jdk7’ then it will resolve to ‘/ade_autofs/gd29_3rdparty/nfsdo_generic/JDK7/MAIN/LINUX.X64/150608.1.7.0.85.0B015/jdk7’ itself.
Can you try adding the following to your build script and verify the result?
assert new File("/usr/local/packages/jdk7”).canonicalFile == new File("/ade_autofs/gd29_3rdparty/nfsdo_generic/JDK7/MAIN/LINUX.X64/1 50608.1.7.0.85.0B015/jdk7”).canonicalFile
Added below given statements in my build.gradle
println new File(“/usr/local/packages/jdk7”).canonicalFile
println new File(“/usr/local/packages/jdk7/bin/java”).canonicalFile
println new File(“/ade_autofs/gd29_3rdparty/nfsdo_generic/JDK7/MAIN/LINUX.X64/150608.1.7.0.85.0B015/jdk7”).canonicalFile
println new File(“/ade_autofs/gd29_3rdparty/nfsdo_generic/JDK7/MAIN/LINUX.X64/150608.1.7.0.85.0B015/jdk7/bin/java”).canonicalFile
assert new File(“/usr/local/packages/jdk7/bin/java”).canonicalFile == new File(“/ade_autofs/gd29_3rdparty/nfsdo_generic/JDK7/MAIN/LINUX.X64/150608.1.7.0.85.0B015/jdk7/bin/java”).canonicalFile
assert new File(“/usr/local/packages/jdk7”).canonicalFile == new File(“/ade_autofs/gd29_3rdparty/nfsdo_generic/JDK7/MAIN/LINUX.X64/150608.1.7.0.85.0B015/jdk7”).canonicalFile
My first ‘assert’ statement is working fine, but the second one is failing.
Output:
/ade_autofs/gd29_3rdparty/JDK7_MAIN_LINUX.X64.rdd/150608.1.7.0.85.0B015/jdk7
/ade_autofs/gd29_3rdparty/nfsdo_generic/JDK7/MAIN/LINUX.X64/150608.1.7.0.85.0B015/jdk7/bin/java
/ade_autofs/gd29_3rdparty/nfsdo_generic/JDK7/MAIN/LINUX.X64/150608.1.7.0.85.0B015/jdk7
/ade_autofs/gd29_3rdparty/nfsdo_generic/JDK7/MAIN/LINUX.X64/150608.1.7.0.85.0B015/jdk7/bin/java
FAILURE: Build failed with an exception.
assert new File(“/usr/local/packages/jdk7”).canonicalFile == new File(“/ade_autofs/gd29_3rdparty/nfsdo_generic/JDK7/MAIN/LINUX.X64/150608.1.7.0.85.0B015/jdk7”).canonicalFile
| | | | |
/usr/local/packages/jdk7 | | /ade_autofs/gd29_3rdparty/nfsdo_generic/JDK7/MAIN/LINUX.X64/150608.1.7.0.85.0B015/jdk7 /ade_autofs/gd29_3rdparty/nfsdo_generic/JDK7/MAIN/LINUX.X64/150608.1.7.0.85.0B015/jdk7
| false
/ade_autofs/gd29_3rdparty/JDK7_MAIN_LINUX.X64.rdd/150608.1.7.0.85.0B015/jdk7