Проблема с SonarQube 5.6.5 и Maven

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

И я скачал и установил 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 и той же проблеме.

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

Бен


person Ben Chevallereau    schedule 16.02.2017    source источник
comment
Какую версию maven вы используете и что такое JDK?   -  person pringi    schedule 16.02.2017
comment
Для Maven я использую Maven 3.3.3. И JDK: java версии 1.8.0_45 Java(TM) SE Runtime Environment (сборка 1.8.0_45-b14) Java HotSpot(TM) 64-битный сервер VM (сборка 25.45-b02, смешанный режим)   -  person Ben Chevallereau    schedule 16.02.2017
comment
Попробуйте обновить maven до версии 3.3.9 и sonar-maven-plugin до 5.1.   -  person pringi    schedule 16.02.2017
comment
Плагин Sonar правильный, потому что следует помнить о другом groupId, если файл sonar-maven-plugin. И обновление до Maven 3.3.9 ничего не изменит. Это вызвано проблемой использования самого сервера SonarQube...   -  person khmarbaise    schedule 16.02.2017
comment
Спасибо за ответ. Я обновил maven, но ничего не изменилось. Затем я обновил версию sonar-maven-form с 3.2, как это было раньше, на 5.1, но не находит эту версию: <plugin><groupId>org.sonarsource.scanner.maven</groupId><artifactId>sonar-maven-plugin</artifactId><version>5.1</version></plugin>   -  person Ben Chevallereau    schedule 16.02.2017
comment
К вашему сведению, я тестировал этот проект, предоставленный SonarQube, но тот же результат: github.com/SonarSource/sonar-examples/tree/master/projects/   -  person Ben Chevallereau    schedule 16.02.2017
comment
@pringi о чем ты? сонар-maven-плагин 5.1? последнее, что я знаю, это ‹dependency› ‹groupId›org.sonarsource.scanner.maven‹/groupId› ‹artifactId›sonar-maven-plugin‹/artifactId› ‹version›3.3.0.603‹/version› ‹/dependency› нет?   -  person Maxence Lecointe    schedule 31.05.2017


Ответы (1)


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

person Ben Chevallereau    schedule 16.02.2017