JUnit test code throws the following error when attempting to connect to a daemon (newly spawned): https://gist.github.com/anonymous/5614197
I connect by specifying the version for Gradle (1.6) and the JDK home directory but nothing special.
I have extracted the interesting part from the stacktrace:
It won't be possible to reconnect to this daemon. Context mismatch:
Java home is different.
Wanted: DefaultDaemonContext[uid=null,javaHome=C:\Program Files\Java\jdk1.6.0_29\jre,daemonRegistryDir=C:\Users\Kelemen Attila\.gradle\daemon,pid=3304,idleTimeout=null,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=windows-1250]
Actual: DefaultDaemonContext[uid=5c9b4a84-5679-4c30-a9a4-3eda317c8c9b,javaHome=C:\Program Files\Java\jdk1.6.0_29,daemonRegistryDir=C:\Users\Kelemen Attila\.gradle\daemon,pid=5792,idleTimeout=10800000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=windows-1250]
As you can see the difference is “uid=null” and “idleTimeout=null”.
EDIT: Just noticed that the real difference is “C:\Program Files\Java\jdk1.6.0_29\jre” and “C:\Program Files\Java\jdk1.6.0_29”. It is strange because the same code works inside the NetBeans Gradle plugin.
EDIT2: The difference in test code and real code is that for Java home (‘ModelBuilder.setJavaHome’) a JRE (within the JDK directory) is specified instead of JDK dir. I don’t know if it is something expected to happen for this case.