Jenkins Sonar plugin unexpectedly stops working

Our Jenkins builds started crashing with an error:

[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.7:sonar (default-cli) on project <project>: Execution default-cli of goal org.codehaus.mojo:sonar-maven-plugin:2.7:sonar failed: Unable to load the mojo 'sonar' in the plugin 'org.codehaus.mojo:sonar-maven-plugin:2.7' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/codehaus/mojo/sonar/SonarMojo : Unsupported major.minor version 51.0 

Java 6 is still running on the Jenkins server, but we haven't changed anything.

What happened and how do we fix it?

+7
jenkins sonarqube java-6
source share
1 answer

jenkins-sonar-plugin uses sonar-maven-plugin to perform sonar analysis.

Sonar-maven-plugin has been updated to version 2.7 on 2015-10-19, and the new version is not compatible with Java 6.

The Jenkins-sonar-plugin uses the latest sonar-maven plugin by default, but you can override this.

So, to fix the error, open "Manage Jenkins" / "Configure System", find the section "Sonar", click "Advanced" and enter 2.6 in the "Version sonar-maven-plugin". This forces jenkins-sonar-plugin to use the previous version of sonar-maven-plugin, which works with Java 6.

Alternatively, if you want to install 2.6 for just one specific Jenkins job, you can force maven to use version 2.6 using the target org.codehaus.mojo:sonar-maven-plugin:2.6:sonar instead of the standard sonar:sonar .

Also: Start planning to upgrade your build server to Java 7 or Java 8.

+25
source share

All Articles