Home > Software design >  Java code is 1.8 supported, SonarQube version supports Java 11, the build fails in Jenkins
Java code is 1.8 supported, SonarQube version supports Java 11, the build fails in Jenkins

Time:12-16

folks!

I have 2 separate servers on Linux for Jenkins and Sonarqube. The code is written in Java 1.8 and can be compiled using Jenkins. Everything works fine. It fails at the SonarQube step because our SonarQube uses Java 11, and it fails with this error.

ERROR: Error during SonarScanner execution java.lang.UnsupportedClassVersionError: org/sonar/batch/bootstrapper/EnvironmentInformation 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 

How can I fix this?

CodePudding user response:

You have to run the sonar scanner with at least Java 11, no matter what version of Java your application supports.

CodePudding user response:

Two years ago I had a similar issue. I don't know if your app and sonarqube should run on the same machine (as it was in my case).

If yes, just install both versions of java and set the path of Java 11 to SonarQube settings.

According to sonarqube community, you should do the following:

  1. Edit conf\wrapper.conf, specifically the wrapper.java.command to following:

wrapper.java.command=C:\Program Files\Java\open jdk-11.0.2\bin\java #wrapper.java.command=java

  • Related