Is sourceCompatibility ignored when org.gradle.java.home property set?


(Baron Roberts) #1

When compiling a Java project I set the org.gradle.java.home property to point to a JDK 8 distribution. In my build.gradle file I set:

sourceCompatibility = 1.6 targetCompatibility = 1.6

When I try to compile, it fails with the message:

javacTask: target release 1.6 conflicts with default source release 1.8

This also occurs if I set the org.gradle.java.home to point to a JDK 7. I have seen this on Gradle 1.12 as well as Gradle 2.0. All builds are being done on Linux.

When I use JAVA_HOME instead of specifying the org.gradle.java.home property, I do not see this problem and my compile produces the appropriately versioned class files.


(Baron Roberts) #2

Pilot error. We were setting the sourceCompatibility down in one of our plugins, which was causing the -source flag to not be passed to javac by gradle.