2017-02-16 72 views
-1

在過去的幾天裏,我嘗試讓SonarQube在我的本地工作,使用一個非常簡單的Maven項目。我不想從我的一個項目開始,但我想從一個教程開始。所以,我重新使用了下面的Github項目: https://github.com/mechero/code-quality-gameSonarQube 5.6.5和Maven的問題

而且我在本地下載並安裝了SonarQube 5.6.5。我收到的第一條消息是這一個:

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 

通過登錄到UI,我注意到,有針對Java插件的新版本。所以,我更新了它,並刪除了本地緩存並重新啓動。然後,我得到這個錯誤:

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 

所以我上傳的所有插件在SonarQube,但同樣的問題。因爲問題出在傳感器,我決定通過將下面的屬性,迫使語言到Java:

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

而現在,我有以下錯誤:

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 

而且我被困現在這個錯誤有好幾天了。我甚至試圖在全新的SpringBoot應用程序和相同的問題上做同樣的事情。

如果你能幫助我,請提前致謝。

+0

您使用的是哪個版本的maven,以及JDK是什麼? – pringi

+0

對於Maven,我使用Maven 3.3.3。和JDK: Java版本「1.8.0_45」 Java™SE運行時環境(內部版本1.8.0_45-b14) Java HotSpot™64位服務器VM(版本25.45-b02,混合模式) –

+0

Try更新maven到版本3.3.9和sonar-maven-plugin到5.1 – pringi

回答

0

問題已解決。與SonarQube或Java沒有任何關係。我意識到變量MAVEN_HOME配置不正確。謝謝你的幫助。