0

I have a multi-module maven project with the following versions of softwares:

Maven : 3.2.1
JDK : 1.6
sonar-maven-plugin : 3.4.0

SonarQube server : 6.7.0 (Build 33306)

I get the following error on running clean sonar:sonar :

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905:sonar (default-cli) on project MyProject: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905:sonar failed: Unable to load the mojo 'sonar' in the plugin 'org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/sonarsource/scanner/maven/SonarQubeMojo : Unsupported major.minor version 52.0
    [ERROR] -----------------------------------------------------
    [ERROR] realm =    plugin>org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905
    [ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy

I believe it has got something to do with the compatibilty of all the software togather. Can someone help.

agabrys
  • 8,728
  • 3
  • 35
  • 73
saupan
  • 273
  • 3
  • 6
  • 15

2 Answers2

2
Unsupported major.minor version 52.0

It means that you have to use JDK 8 or newer instead of JDK 6.

See more about maroj.minor versions here.

agabrys
  • 8,728
  • 3
  • 35
  • 73
  • I have a project which can built and deployed using JDK 1.6 only. A version above creates issues with the build. Now to analyse the project using Sonar (deployed on another server with sonar version 6.7.0) I am getting this issue. I cannot update JDK version or else my project wont build. – saupan May 07 '18 at 07:28
  • 1
    You can build your project with JDK6 and after the build run `sonar:sonar` with JDK8. This is the only option which you have. – agabrys May 07 '18 at 08:40
  • thanks agabrys! I guess I have only this option left. :) – saupan May 07 '18 at 10:41
1

set java 8 and try to build, as below

export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)

make sure you, it set to java 8

java -version you must see result as below

java version "1.8.0_162"

execute following command to build

mvn sonar:sonar -Dsonar.host.url=http://localhost:9000 -Dsonar.login=3554cf2f4ed3edd014b9c52a62a2d3c0a0604315 -Dhttps.protocols=TLSv1.2

Allahbakash.G
  • 1,805
  • 1
  • 15
  • 17