mavensonarqubesonarqube-scansonarqube5.6

Issue with SonarQube 5.6.5 and Maven


For the last few days, I try to have SonarQube working on my local with a very simple Maven project. I didn't want to start with one of my project, but I wanted to start from a tutorial. So, I re-used the following Github project: https://github.com/mechero/code-quality-game

And I downloaded and installed SonarQube 5.6.5 on my local. The first message that I received was this one:

objc[57607]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin/java (0x10adf04c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x10aeb84e0). One of the two will be used. Which one is undefined.
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building code-quality-game 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- sonar-maven-plugin:3.2:sonar (default-cli) @ code-quality-game ---
[INFO] User cache: /Users/benjamin.chevallerea/.sonar/cache
[INFO] Load global repositories
[INFO] Load global repositories (done) | time=322ms
[INFO] User cache: /Users/benjamin.chevallerea/.sonar/cache
[INFO] Load plugins index
[INFO] Load plugins index (done) | time=5ms
[INFO] SonarQube version: 5.6.5
[INFO] Default locale: "en_US", source code encoding: "UTF-8"
[INFO] Process project properties
[INFO] Load project repositories
[INFO] Load project repositories (done) | time=29ms
[INFO] Load quality profiles
[INFO] Load quality profiles (done) | time=169ms
[INFO] Load active rules
[INFO] Load active rules (done) | time=717ms
[INFO] Publish mode
[INFO] -------------  Scan code-quality-game
[INFO] Load server rules
[INFO] Load server rules (done) | time=156ms
[INFO] Base dir: /Users/benjamin.chevallerea/Downloads/code-quality-game/sonar-connector
[INFO] Working dir: /Users/benjamin.chevallerea/Downloads/code-quality-game/sonar-connector/target/sonar
[INFO] Source paths: pom.xml, src/main/java
[INFO] Test paths: src/test/java
[INFO] Binary dirs: target/classes
[INFO] Source encoding: UTF-8, default locale: en_US
[INFO] Index files
[INFO] Excluded sources: 
[INFO]   **/resultbeans/*.java
[INFO] 36 files indexed
[INFO] 5 files ignored because of inclusion/exclusion patterns
[INFO] Quality profile for java: Sonar way
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.979 s
[INFO] Finished at: 2017-02-16T11:21:42+00:00
[INFO] Final Memory: 68M/1963M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar (default-cli) on project code-quality-game: Unable to load component class org.sonar.java.SonarComponents: org/springsource/loaded/ri/ReflectiveInterceptor: org.springsource.loaded.ri.ReflectiveInterceptor -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

By logging to the UI, I noticed that there was a new version for the Java plugin. So, I updated it and I deleted my local cache and restarted. Then, I got this error:

objc[57893]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin/java (0x10ebdc4c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x10eca44e0). One of the two will be used. Which one is undefined.
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building code-quality-game 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- sonar-maven-plugin:3.2:sonar (default-cli) @ code-quality-game ---
[INFO] User cache: /Users/benjamin.chevallerea/.sonar/cache
[INFO] Load global repositories
[INFO] Load global repositories (done) | time=312ms
[INFO] User cache: /Users/benjamin.chevallerea/.sonar/cache
[INFO] Load plugins index
[INFO] Load plugins index (done) | time=6ms
[INFO] SonarQube version: 5.6.5
[INFO] Default locale: "en_US", source code encoding: "UTF-8"
[INFO] Process project properties
[INFO] Load project repositories
[INFO] Load project repositories (done) | time=36ms
[INFO] Load quality profiles
[INFO] Load quality profiles (done) | time=130ms
[INFO] Load active rules
[INFO] Load active rules (done) | time=719ms
[INFO] Publish mode
[INFO] -------------  Scan code-quality-game
[INFO] Load server rules
[INFO] Load server rules (done) | time=174ms
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.843 s
[INFO] Finished at: 2017-02-16T11:27:11+00:00
[INFO] Final Memory: 64M/1963M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar (default-cli) on project code-quality-game: Unable to load component class org.sonar.batch.sensor.DefaultSensorStorage: Unable to load component class org.sonar.batch.issue.ModuleIssues: Unable to load component class org.sonar.batch.issue.IssueFilters: Unable to load component class org.sonar.java.filters.PostAnalysisIssueFilter: org/springsource/loaded/ri/ReflectiveInterceptor: org.springsource.loaded.ri.ReflectiveInterceptor -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

So I uploaded all plugins in SonarQube, but same issues. Because the problem is with the sensor, I decided to force the language to Java by adding the following property:

<sonar.language>java</sonar.language>

And now, I have the following error:

objc[58166]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin/java (0x1090c54c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x10918d4e0). One of the two will be used. Which one is undefined.
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building code-quality-game 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- sonar-maven-plugin:3.2:sonar (default-cli) @ code-quality-game ---
[INFO] User cache: /Users/benjamin.chevallerea/.sonar/cache
[INFO] Load global repositories
[INFO] Load global repositories (done) | time=191ms
[INFO] User cache: /Users/benjamin.chevallerea/.sonar/cache
[INFO] Load plugins index
[INFO] Load plugins index (done) | time=4ms
[INFO] SonarQube version: 5.6.5
[INFO] Default locale: "en_US", source code encoding: "UTF-8"
[INFO] Process project properties
[INFO] Load project repositories
[INFO] Load project repositories (done) | time=26ms
[INFO] Load quality profiles
[INFO] Load quality profiles (done) | time=50ms
[INFO] Load active rules
[INFO] Load active rules (done) | time=431ms
[INFO] Publish mode
[INFO] -------------  Scan code-quality-game
[INFO] Language is forced to java
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.123 s
[INFO] Finished at: 2017-02-16T11:32:37+00:00
[INFO] Final Memory: 67M/1963M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar (default-cli) on project code-quality-game: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar failed: A required class was missing while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar: org/springsource/loaded/TypeRegistry
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.sonarsource.scanner.maven:sonar-maven-plugin:3.2
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/Users/benjamin.chevallerea/.m2/repository/org/sonarsource/scanner/maven/sonar-maven-plugin/3.2/sonar-maven-plugin-3.2.jar
[ERROR] urls[1] = file:/Users/benjamin.chevallerea/.m2/repository/org/apache/maven/shared/maven-dependency-tree/2.2/maven-dependency-tree-2.2.jar
[ERROR] urls[2] = file:/Users/benjamin.chevallerea/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[3] = file:/Users/benjamin.chevallerea/.m2/repository/org/eclipse/aether/aether-util/0.9.0.M2/aether-util-0.9.0.M2.jar
[ERROR] urls[4] = file:/Users/benjamin.chevallerea/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar
[ERROR] urls[5] = file:/Users/benjamin.chevallerea/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[6] = file:/Users/benjamin.chevallerea/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.22/plexus-utils-3.0.22.jar
[ERROR] urls[7] = file:/Users/benjamin.chevallerea/.m2/repository/org/sonarsource/scanner/api/sonar-scanner-api/2.8/sonar-scanner-api-2.8.jar
[ERROR] urls[8] = file:/Users/benjamin.chevallerea/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar
[ERROR] urls[9] = file:/Users/benjamin.chevallerea/.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] -----------------------------------------------------: org.springsource.loaded.TypeRegistry
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException

And I'm stuck on this error for few days now. I even tried to do exactly the same on a fresh new SpringBoot app and same issue.

Thanks in advance if you can help me.

Ben


Solution

  • The problem has been solved. Nothing related to SonarQube or Java. I realized that the variable MAVEN_HOME was not configured properly. Thanks for your help.