Ok, I see from the `gradle’ launch script that the JAVA_HOME is being correctly reset inside the Cygwin environment.
Line 45
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
So really forking the JVM to compile should reuse this setting or it perhaps the child process in then resetting the JAVA_HOME. Under a Cygwin environment, how does Gradle fork the JVM process?