java.lang.unsupportedclassversionerror in gradle build

2.2k Views Asked by At

Am getting java.lang.unsupportedclassversionerror in gradle build, it is a multiproject gradle build. Am using Java-8 and it was working so far but, all of a sudden it stopped working and started throwing the below exception.

com.google.common.util.concurrent.ExecutionError: com.google.common.util.concurrent.ExecutionError: com.google.common.util.concurrent.ExecutionError: com.google.common.util.concurrent.ExecutionError: com.google.common.util.concurrent.ExecutionError: java.lang .UnsupportedClassVersionError: org/eclipse/core/runtime/OperationCanceledException has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

below is the seeting.gradle

rootProject.name = 'ecommerce'

include ':ecommerce:commandLine'
include ':ecommerce:commandExecution'

include ':ecommerce:model'
include ':ecommerce:model-validation'
include ':ecommerce:modelframework'
include ':ecommerce:model-graphql'
include ':ecommerce:server'
include ':ecommerce:utilityhandler'

As I already mentioned, this was working till these days and started throwing the above exception. Any help here is appreciated. Thanks in advance

2

There are 2 best solutions below

2
Deadron On

One of your dependencies was compiled to target Java 11 and can't be loaded into a older JRE. Given the package of the class that failed to load you should look for org.eclipse.core dependencies. You will either need to downgrade your dependency or look into updating your codebase to use Java 11.

3
Carl Burke On

I'm also having this problem today. The problem seems to be the Xtend plugin which is now pulling in a version of equinox that was built for java 11 and can't run on the java 8 in our VM. I don't know if our contract will allowed us to update that.