java.lang.UnsupportedClassVersionError: org/sonar/batch/bootstrapper/EnvironmentInformation : Unsupported major.minor version 52.0

user3492783 picture user3492783 · Jun 7, 2016 · Viewed 31.8k times · Source

Environment details:

  • SonarQube 5.6
  • Apache Maven 3.3.9
  • Java version: 1.7.0_09

I integrated SonarQube plugin with java maven project like in pom.xml

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.sonarsource.scanner.maven</groupId>
                <artifactId>sonar-maven-plugin</artifactId>
                <version>3.0.2</version>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

While executing goal: mvn sonar:sonar -Dsonar.host.url=<url>

Getting exception:

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.2:sonar (default-cli) on project example-java-maven: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.2:sonar failed: An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.2:sonar: java.lang.UnsupportedClassVersionError: org/sonar/batch/bootstrapper/EnvironmentInformation: Unsupported major.minor version 52.0 [ERROR] ----------------------------------------------------- [ERROR] realm = plugin>org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.2

Answer

SonarQube 5.6 requires at least Java 8 (see requirements). Note that this is not a just a requirement on the server side, it's also required on the client side where analysis are ran.

Like agabrys mentioned in his comment, the Unsupported major.minor is a classic Java error (see this thread).