sonar-maven-plugin:3.1.1:升级到SonarQube 6.0后sonar分析错误
sonar-maven-plugin:3.1.1:sonar analyze error after upgrade to SonarQube 6.0
我们刚刚升级到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[=11=]0(MethodInjector.java:39)
at org.picocontainer.injectors.MethodInjector.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
时也会发生这种情况,并且似乎是特定于项目的,有些项目有效,有些则无效。
任何人都可以提供提示这里有什么问题吗?
归功于@teryk-sonarsource-team,只是作为一个答案:
- 删除 SonarQube 安装中的目录 data/es。
- 重新启动 SonarQube。
它将重新计算所有 ES 索引。
这解决了我在 SonarQube 5.6.3 中的问题。
我们刚刚升级到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[=11=]0(MethodInjector.java:39)
at org.picocontainer.injectors.MethodInjector.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
时也会发生这种情况,并且似乎是特定于项目的,有些项目有效,有些则无效。
任何人都可以提供提示这里有什么问题吗?
归功于@teryk-sonarsource-team,只是作为一个答案:
- 删除 SonarQube 安装中的目录 data/es。
- 重新启动 SonarQube。
它将重新计算所有 ES 索引。
这解决了我在 SonarQube 5.6.3 中的问题。