Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Incompatibility:org.codehaus.plexus. .exception.ComponentLookupException

When I tried to run mvn sonar:sonar command on my project often I'm getting below error:

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar (default-c
li) on project ProjectName: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-mav
en-plugin:3.2:sonar failed: Unable to load the mojo 'sonar' in the plugin 'org.sonarsource.scanner.m
aven:sonar-maven-plugin:3.2' 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.codehaus.mojo:sonar-maven-plugin:3.2
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/U39/.m2/repository/org/sonarsource/scanner/maven/sonar-maven-pl
ugin/3.2/sonar-maven-plugin-3.2.jar
[ERROR] urls[1] = file:/C:/Users/U39/.m2/repository/org/apache/maven/shared/maven-dependency-tre
e/2.2/maven-dependency-tree-2.2.jar
[ERROR] urls[2] = file:/C:/Users/U39/.m2/repository/org/codehaus/plexus/plexus-component-annotat
ions/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[3] = file:/C:/Users/U39/.m2/repository/org/eclipse/aether/aether-util/0.9.0.M2/aeth
er-util-0.9.0.M2.jar
[ERROR] urls[4] = file:/C:/Users/U39/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.
4/plexus-sec-dispatcher-1.4.jar
[ERROR] urls[5] = file:/C:/Users/U39/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus
-cipher-1.4.jar
[ERROR] urls[6] = file:/C:/Users/U39/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.22/plex
us-utils-3.0.22.jar
[ERROR] urls[7] = file:/C:/Users/U39/.m2/repository/org/sonarsource/scanner/api/sonar-scanner-ap
i/2.8/sonar-scanner-api-2.8.jar
[ERROR] urls[8] = file:/C:/Users/U39/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2
.6.jar
[ERROR] urls[9] = file:/C:/Users/U39/.m2/repository/com/google/code/findbugs/jsr305/2.0.3/jsr305
-2.0.3.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------
[ERROR] -> [Help 1]

I have gone through so many resources or links and got to know that compatibility issue comes only when we use different versions of java compiler. Though I ran my java code on Java 8, still I could see the above error.

Version Details:
Java :1.8
Maven : 3.0.5
SonarQube : 5.4

Can someone help me out of this issue.

like image 298
Praveen Kumar Mekala Avatar asked Oct 10 '16 11:10

Praveen Kumar Mekala


1 Answers

Maven itself must use Java 8 to execute that sonar Maven plugin. Use mvn --version to check if it uses Java 8. If it does not, adjust your JAVA_HOME environment variable to point to a Java 8 installation.

like image 93
Florian Albrecht Avatar answered Nov 15 '22 06:11

Florian Albrecht