SOLVED: Gradle fails to configure build on OSX with Unsupported major.minor version 52.0


(Felix) #1

Hi,

I have a multi-project build that is based on gradle-wrapper and that uses a custom groovy plugin located under <PROJ_ROOT>/buildSrc. I just tried to run the build on a OSX 10.11 machine for the first time, first doing a

./gradlew tasks

and this is what I get after the 2.14 has been downloaded (so I assume gradle already entered the configuration phase):

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':commons'.
> Could not open cp_proj remapped class cache for 6y3peleauqfffiprbh9m1qob (/Users/ron/.gradle/caches/2.14/scripts-remapped/build_7vyh6jylyqyhd71wl0mws6l2r/6y3peleauqfffiprbh9m1qob/cp_proj5271940521320097676).
   > Could not open cp_proj generic class cache for build file '/Users/ron/git-local/swheel/commons/build.gradle' (/Users/ron/.gradle/caches/2.14/scripts/6y3peleauqfffiprbh9m1qob/cp_proj/cp_proj5271940521320097676).
      > com/swheel/gradle/tasks/Antlr4Task : Unsupported major.minor version 52.0

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Java 1.8 is the default JRE on this machine. Also, JAVA_HOME is not set. What I don’t understand here is what part of the build could be using a jre in any version other than 1.8 if 1.8 is the default? I also have no idead how to further debug this issue (tried runnng with --debug but the output is very verbose and I don’t know what to look for). Any help is greatly appreaciated.

thank,
f.


(Felix) #2

This is the output of gradlew --version; it also reports that jav 1.8. is used:

./gradlew --version

------------------------------------------------------------
Gradle 2.14
------------------------------------------------------------

Build time:   2016-06-14 07:16:37 UTC
Revision:     cba5fea19f1e0c6a00cc904828a6ec4e11739abc

Groovy:       2.4.4
Ant:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM:          1.8.0-ea (Oracle Corporation 24.0-b20)
OS:           Mac OS X 10.11.5 x86_64

(Felix) #3

Ok, solved it.

The problem was the jre version 1.8.0-ea in conjunction with a custom groovy plugin located under buildSrc. Any sub projects attempting to use this plugin fail to complete the configuration phase. It seems that the groovy compiler produces 1.8 byte code that jre-1.8.0-ea fails to read.

The solution is to wipe out java 1.8.0-ea from the machine and re-install a current version of java 1.8. Note that updating via the java control panel does not work as expected (at least on this machine) so we needed to wipe out the files using the console.