sonar-maven-plugin:3.1.1:升级到SonarQube 6.0之后的声纳分析错误

时间:2016-09-14 06:41:11

标签: sonarqube sonarqube-scan

我们刚刚升级到SQ 6.0,现在有些项目在使用maven分析时出现以下错误:

[INFO] --- sonar-maven-plugin:3.1.1:sonar (default-cli) @ gitlab-hook-dispatcher ---
[INFO] User cache: C:\Users\frank.jakop\.sonar\cache
[INFO] Load global repositories
[INFO] Load global repositories (done) | time=94ms
[INFO] User cache: C:\Users\frank.jakop\.sonar\cache
[INFO] Load plugins index
[INFO] Load plugins index (done) | time=5ms
[INFO] SonarQube version: 6.0
[INFO] Default locale: "de_DE", source code encoding: "UTF-8"
[INFO] Process project properties
[INFO] Load project repositories
[INFO] Load project repositories (done) | time=162ms
[INFO] Execute project builders
[INFO] Execute project builders (done) | time=1ms
[INFO] Load quality profiles
[INFO] Load quality profiles (done) | time=73ms
[INFO] Load active rules
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.419 s
[INFO] Finished at: 2016-09-14T08:29:20+02:00
[INFO] Final Memory: 67M/495M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.1.1:sonar (default-cli) on project gitlab-hook-dispatcher: Unable to load component class org.sonar.scanner.report.ActiveRulesPublisher: Unable to load component interface org.sonar.api.batch.rule.ActiveRules: NullPointerException -> [Help 1]

追踪的最后部分是

Caused by: java.lang.NullPointerException
    at org.sonar.scanner.rule.DefaultActiveRulesLoader.readPage(DefaultActiveRulesLoader.java:99)
    at org.sonar.scanner.rule.DefaultActiveRulesLoader.load(DefaultActiveRulesLoader.java:59)
    at org.sonar.scanner.rule.ActiveRulesProvider.load(ActiveRulesProvider.java:102)
    at org.sonar.scanner.rule.ActiveRulesProvider.load(ActiveRulesProvider.java:63)
    at org.sonar.scanner.rule.ActiveRulesProvider.provide(ActiveRulesProvider.java:49)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.picocontainer.injectors.MethodInjector.invokeMethod(MethodInjector.java:129)
    at org.picocontainer.injectors.MethodInjector.access$000(MethodInjector.java:39)
    at org.picocontainer.injectors.MethodInjector$2.run(MethodInjector.java:113)
    at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
    at org.picocontainer.injectors.MethodInjector.decorateComponentInstance(MethodInjector.java:120)
    at org.picocontainer.injectors.CompositeInjector.decorateComponentInstance(CompositeInjector.java:58)
    at org.picocontainer.injectors.Reinjector.reinject(Reinjector.java:142)
    at org.picocontainer.injectors.ProviderAdapter.getComponentInstance(ProviderAdapter.java:96)
    at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
    at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
    at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:67)
    ... 72 more

当我们使用org.codehaus.mojo:sonar-maven-plugin:2.7.1:sonar并且似​​乎是项目特定的,有些项目有效,有些项目不合适时,也会发生这种情况。

任何人都可以提示这里有什么问题吗?

1 个答案:

答案 0 :(得分:8)

归功于@ teryk-sonarsource-team,只需回答:

  1. 删除SonarQube安装中的目录数据/。
  2. 重启SonarQube。
  3. 它将重新计算所有ES索引。

    这解决了我在SonarQube 5.6.3中的问题。