2

我知道这与SonarQube 后台任务因 IllegalArgumentException for Java 失败非常相似,但就我而言,我不知道问题到底出在哪里。这是我的日志:

2016.02.03 13:24:22 ERROR [o.s.s.c.t.CeWorkerCallableImpl] Failed to execute task AVKnFyTzP-Q7QH-_7ITt
java.lang.IllegalArgumentException: Multiple entries with same key: scala=Scala and scala=Scala
at com.google.common.collect.ImmutableMap.checkNoConflict(ImmutableMap.java:150) ~[guava-17.0.jar:na]
at com.google.common.collect.RegularImmutableMap.checkNoConflictInBucket(RegularImmutableMap.java:104) ~[guava-17.0.jar:na]
at com.google.common.collect.RegularImmutableMap.<init>(RegularImmutableMap.java:70) ~[guava-17.0.jar:na]
at com.google.common.collect.ImmutableMap$Builder.build(ImmutableMap.java:254) ~[guava-17.0.jar:na]
at com.google.common.collect.Maps.uniqueIndex(Maps.java:1166) ~[guava-17.0.jar:na]
at com.google.common.collect.Maps.uniqueIndex(Maps.java:1140) ~[guava-17.0.jar:na]
at org.sonar.server.computation.language.LanguageRepositoryImpl.<init>(LanguageRepositoryImpl.java:46) ~[sonar-server-5.3.jar:na]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_72-internal]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_72-internal]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_72-internal]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_72-internal]
at org.picocontainer.injectors.AbstractInjector.newInstance(AbstractInjector.java:145) ~[picocontainer-2.15.jar:na]
at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:342) ~[picocontainer-2.15.jar:na]
at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270) ~[picocontainer-2.15.jar:na]
at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364) ~[picocontainer-2.15.jar:na]
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56) ~[picocontainer-2.15.jar:na]
at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64) ~[picocontainer-2.15.jar:na]
at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91) ~[picocontainer-2.15.jar:na]
at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699) ~[picocontainer-2.15.jar:na]
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647) ~[picocontainer-2.15.jar:na]
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632) ~[picocontainer-2.15.jar:na]
at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118) ~[picocontainer-2.15.jar:na]
at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136) ~[picocontainer-2.15.jar:na]
at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78) ~[picocontainer-2.15.jar:na]
at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309) ~[picocontainer-2.15.jar:na]
at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335) ~[picocontainer-2.15.jar:na]
at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270) ~[picocontainer-2.15.jar:na]
at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364) ~[picocontainer-2.15.jar:na]
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56) ~[picocontainer-2.15.jar:na]
at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64) ~[picocontainer-2.15.jar:na]
at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91) ~[picocontainer-2.15.jar:na]
at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699) ~[picocontainer-2.15.jar:na]
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647) ~[picocontainer-2.15.jar:na]
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:678) ~[picocontainer-2.15.jar:na]
at org.sonar.core.platform.ComponentContainer.getComponentByType(ComponentContainer.java:262) ~[sonar-core-5.3.jar:na]
at org.sonar.server.computation.step.AbstractComputationSteps$1.apply(AbstractComputationSteps.java:43) ~[sonar-server-5.3.jar:na]
at org.sonar.server.computation.step.AbstractComputationSteps$1.apply(AbstractComputationSteps.java:40) ~[sonar-server-5.3.jar:na]
at com.google.common.collect.Iterators$8.transform(Iterators.java:794) ~[guava-17.0.jar:na]
at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48) ~[guava-17.0.jar:na]
at org.sonar.server.computation.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:37) ~[sonar-server-5.3.jar:na]
at org.sonar.server.computation.taskprocessor.report.ReportTaskProcessor.process(ReportTaskProcessor.java:72) ~[sonar-server-5.3.jar:na]
at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.executeTask(CeWorkerCallableImpl.java:81) [sonar-server-5.3.jar:na]
at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.call(CeWorkerCallableImpl.java:56) [sonar-server-5.3.jar:na]
at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.call(CeWorkerCallableImpl.java:35) [sonar-server-5.3.jar:na]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_72-internal]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_72-internal]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_72-internal]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_72-internal]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_72-internal]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_72-internal]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_72-internal]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_72-internal]
2016.02.03 13:24:22 ERROR [o.s.s.c.t.CeWorkerCallableImpl] Executed task | project=org.codehaus.sonar:javascript-sonar-runner-lcov:iss-hipcms-269 | id=AVKnFyTzP-Q7QH-_7ITt | time=3823ms

问题是我只能看到java.lang.IllegalArgumentException: Multiple entries with same key: scala=Scala and scala=Scala,所以我不确定问题出在哪里。

之前已经有一个项目,我对两个项目都使用了相同的属性。是否可能因为我为他们两个都设置了这个问题sonar.projectKey=org.codehaus.sonar:javascript-sonar-runner-lcov?或者这不是错误消息所指的关键?如果是,那么我应该把什么作为一个sonar.projectKey

4

2 回答 2

3

您正在使用 2 个插件(scalastyle 和 scoverage),它们向 SonarQube 声明完全相同的语言(scala)。这不是插件的行为方式:应该有一个插件声明该语言(理想情况下命名为“sonar-scala-plugin”)和其他将引用该语言的侧面插件(但不声明它)。

一旦这些插件的开发人员就哪个插件声明语言以及哪个其他插件引用它达成一致,您的问题就应该得到解决。

于 2016-02-12T12:43:54.147 回答
1

我遇到了同样的问题,我所做的如下:

  1. 我制作了一个 sonar-scala-plugin 来定义 scala 语言并将其添加到我的 sonaqube 中。
  2. 我从 scalastyle 插件下载了源代码:https ://github.com/NCR-CoDE/sonar-scalastyle和 scoverage 插件:https ://github.com/RadoBuransky/sonar-scoverage-plugin
  3. 然后我重构了代码,在扩展声纳插件的类中,我删除了定义语言的类:我的 ScalastylePlugin 如下所示:

    覆盖 def getExtensions: java.util.List[Class[_ <: Extension]] = ListBuffer( classOf[ScalastyleRepository], classOf[ScalastyleQualityProfile], classOf[ScalastyleSensor] )

  4. 我对声纳覆盖插件做了同样的事情。在扩展 SonarPlugin 的类中,我删除了 classOf[Scala];

  5. 然后我构建了所有插件并将插件 jar 文件添加到 sonarqube。

于 2016-04-29T12:34:02.403 回答