JAVA_HOME=/usr/java/latest ./gradlew build
> Task :compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Could not target platform: 'Java SE 11' using tool chain: 'JDK 8 (1.8)'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
1 actionable task: 1 executed
JAVA_HOME=/usr/java/jdk-11.0.2 ./gradlew build --info
Initialized native services in: /home/bvn13/.gradle/native
Found daemon DaemonInfo{pid=5758, address=[b82b6024-c8ec-4436-a205-444355f67431 port:38887, addresses:[/0:0:0:0:0:0:0:1, /127.0.0.1]], state=Idle, lastBusy=1553359295367, context=DefaultDaemonContext[uid=d2ed7581-de73-4df7-9ff6-933d2268b518,javaHome=/usr/java/jdk1.8.0_201-amd64,daemonRegistryDir=/home/bvn13/.gradle/daemon,pid=5758,idleTimeout=10800000,daemonOpts=-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]} however its context does not match the desired criteria.
Java home is different.
Wanted: DefaultDaemonContext[uid=null,javaHome=/usr/java/jdk-11.0.2,daemonRegistryDir=/home/bvn13/.gradle/daemon,pid=16386,idleTimeout=null,daemonOpts=-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]
Actual: DefaultDaemonContext[uid=d2ed7581-de73-4df7-9ff6-933d2268b518,javaHome=/usr/java/jdk1.8.0_201-amd64,daemonRegistryDir=/home/bvn13/.gradle/daemon,pid=5758,idleTimeout=10800000,daemonOpts=-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]
Looking for a different daemon...
The client will now receive all logging from the daemon (pid: 6001). The daemon log file: /home/bvn13/.gradle/daemon/4.7/daemon-6001.out.log
Starting 5th build in daemon [uptime: 2 hrs 12 mins 59.528 secs, performance: 92%]
Using 4 worker leases.
FAILURE: Build failed with an exception.
* What went wrong:
Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
> Could not create service of type PluginResolutionStrategyInternal using BuildScopeServices.createPluginResolutionStrategy().
* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s