2017-02-16 13 views
-1

В течение последних нескольких дней я стараюсь, чтобы SonarQube работал на моем локальном компьютере с очень простым проектом Maven. Я не хотел начинать с одного из моих проектов, но я хотел начать с учебника. Итак, я повторно использовал следующий проект Github: https://github.com/mechero/code-quality-gameПроблема с SonarQube 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 

Входя в пользовательский интерфейс, я заметил, что появилась новая версия для плагина 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 и той же самой проблеме.

Заранее спасибо, если вы можете мне помочь.

Ben

+0

Какую версию maven вы используете и что такое JDK? – pringi

+0

Для Maven я использую Maven 3.3.3. И JDK: java-версия «1.8.0_45» Рабочая среда Java (TM) SE (сборка 1.8.0_45-b14) 64-разрядная виртуальная машина Java HotSpot TM (сборка 25.45-b02, смешанный режим) –

+0

Попробуйте обновить maven до версии 3.3.9 и сонар-maven-plugin до 5.1. – pringi

ответ

0

Проблема была решена. Ничего не связано с SonarQube или Java. Я понял, что переменная MAVEN_HOME не настроена должным образом. Спасибо за вашу помощь.