4

我尝试从 SonarQube 的 5.1 迁移到 5.3 版本。SonarQube 插件:

  • Cobertura 1.6.3 (cobertura)
  • C# 4.4 (csharp)
  • Java 3.9 (Java)
  • XML 1.4 (xml)
  • Git 1.0 (scmgit)
  • SVN 1.2 (scmsvn)
  • JavaScript 2.10 (javascript)

我的项目使用 Java、XML、JavaScript 和 jaCoCo 代码覆盖率。

客户端分析工作正常,但在服务器端集成期间我在日志中有一个堆栈跟踪:

(end of logs)
2016.02.04 10:45:17 INFO  [o.s.s.c.s.ComputationStepExecutor] Log scanner context | time=11ms
2016.02.04 10:45:17 INFO  [o.s.s.c.s.ComputationStepExecutor] Load analysis metadata | time=1ms
2016.02.04 10:45:17 INFO  [o.s.s.c.s.ComputationStepExecutor] Build tree of components | time=236ms
2016.02.04 10:45:17 INFO  [o.s.s.c.s.ComputationStepExecutor] Validate project | time=25ms
2016.02.04 10:45:17 INFO  [o.s.s.c.s.ComputationStepExecutor] Load debt model | time=1ms
2016.02.04 10:45:17 INFO  [o.s.s.c.s.ComputationStepExecutor] Load quality profiles | time=63ms
2016.02.04 10:45:17 INFO  [o.s.s.c.s.ComputationStepExecutor] Load Quality gate | time=2ms
2016.02.04 10:45:17 INFO  [o.s.s.c.s.ComputationStepExecutor] Load differential periods | time=74ms
2016.02.04 10:45:17 INFO  [o.s.s.c.s.ComputationStepExecutor] Load inner file and in project duplications | time=76ms
2016.02.04 10:45:17 INFO  [o.s.s.c.d.CrossProjectDuplicationStatusHolderImpl] Cross project duplication is disabled because it's disabled in the analysis report
2016.02.04 10:45:17 INFO  [o.s.s.c.s.ComputationStepExecutor] Compute cross project duplications | time=0ms
2016.02.04 10:45:17 INFO  [o.s.s.c.s.ComputationStepExecutor] Compute size measures | time=309ms
2016.02.03 16:22:20 ERROR [o.s.s.c.t.CeWorkerCallableImpl] Failed to execute task AVKn8PiS4ITZfzVrMvMq
org.sonar.server.computation.component.VisitException: Visit failed for Component {key=XXXX:XXXX-commons-client:src/main/java/com/XXXX/instrument/InstrumentFrame.java,type=FILE}  located XXXX:XXXX-commons-client:src/main/java/com/XXXX/instrument(type=DIRECTORY)->XXXX:XXXX-commons-client(type=MODULE)->XXXX:XXXX(type=PROJECT)
    at org.sonar.server.computation.component.VisitException.rethrowOrWrap(VisitException.java:44) ~[sonar-server-5.3.jar:na]
    at org.sonar.server.computation.component.PathAwareCrawler.visit(PathAwareCrawler.java:52) ~[sonar-server-5.3.jar:na]
    at org.sonar.server.computation.component.PathAwareCrawler.visitChildren(PathAwareCrawler.java:87) ~[sonar-server-5.3.jar:na]
    at org.sonar.server.computation.component.PathAwareCrawler.visitImpl(PathAwareCrawler.java:70) ~[sonar-server-5.3.jar:na]
    at org.sonar.server.computation.component.PathAwareCrawler.visit(PathAwareCrawler.java:50) ~[sonar-server-5.3.jar:na]
    at org.sonar.server.computation.component.PathAwareCrawler.visitChildren(PathAwareCrawler.java:87) ~[sonar-server-5.3.jar:na]
    at org.sonar.server.computation.component.PathAwareCrawler.visitImpl(PathAwareCrawler.java:70) ~[sonar-server-5.3.jar:na]
    at org.sonar.server.computation.component.PathAwareCrawler.visit(PathAwareCrawler.java:50) ~[sonar-server-5.3.jar:na]
    at org.sonar.server.computation.component.PathAwareCrawler.visitChildren(PathAwareCrawler.java:87) ~[sonar-server-5.3.jar:na]
    at org.sonar.server.computation.component.PathAwareCrawler.visitImpl(PathAwareCrawler.java:70) ~[sonar-server-5.3.jar:na]
    at org.sonar.server.computation.component.PathAwareCrawler.visit(PathAwareCrawler.java:50) ~[sonar-server-5.3.jar:na]
    at org.sonar.server.computation.step.NewCoverageMeasuresStep.execute(NewCoverageMeasuresStep.java:113) ~[sonar-server-5.3.jar:na]
    at org.sonar.server.computation.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:39) ~[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_60]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_60]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_60]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_60]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_60]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_60]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_60]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_60]
Caused by: java.lang.IllegalArgumentException: There's no changeset on line 1352
    at com.google.common.base.Preconditions.checkArgument(Preconditions.java:125) ~[guava-17.0.jar:na]
    at org.sonar.server.computation.scm.ScmInfoImpl.getChangesetForLine(ScmInfoImpl.java:64) ~[sonar-server-5.3.jar:na]
    at org.sonar.server.computation.scm.ReportScmInfo.getChangesetForLine(ReportScmInfo.java:71) ~[sonar-server-5.3.jar:na]
    at org.sonar.server.computation.step.NewCoverageMeasuresStep$NewCoverageCounter.initialize(NewCoverageMeasuresStep.java:391) ~[sonar-server-5.3.jar:na]
    at org.sonar.server.computation.formula.FormulaExecutorComponentVisitor.processLeaf(FormulaExecutorComponentVisitor.java:165) ~[sonar-server-5.3.jar:na]
    at org.sonar.server.computation.formula.FormulaExecutorComponentVisitor.process(FormulaExecutorComponentVisitor.java:142) ~[sonar-server-5.3.jar:na]
    at org.sonar.server.computation.formula.FormulaExecutorComponentVisitor.visitFile(FormulaExecutorComponentVisitor.java:122) ~[sonar-server-5.3.jar:na]
    at org.sonar.server.computation.component.PathAwareCrawler.visitNode(PathAwareCrawler.java:105) ~[sonar-server-5.3.jar:na]
    at org.sonar.server.computation.component.PathAwareCrawler.visitImpl(PathAwareCrawler.java:73) ~[sonar-server-5.3.jar:na]
    at org.sonar.server.computation.component.PathAwareCrawler.visit(PathAwareCrawler.java:50) ~[sonar-server-5.3.jar:na]
    ... 23 common frames omitted
2016.02.03 16:22:20 ERROR [o.s.s.c.t.CeWorkerCallableImpl] Executed task | project=XXXX:XXXX | id=AVKn8PiS4ITZfzVrMvMq | time=5138ms

笔记:

  • 在之前的分析中,该文件InstrumentFrame.java有 1355 行,我们有块 1349-1352 的 JaCoCo 覆盖数据。
  • 在当前的分析中,文件InstrumentFrame.java现在有 1351 行(那么 1352 是文件外的)
  • 如果我添加文件source file exclusions,分析将成功
  • 成功分析后,我可以安全地从排除列表中删除文件,下一次分析将继续工作
4

2 回答 2

0

只需排除src/main/java/com/XXXX/instrument/InstrumentFrame.java文件并运行分析它就会成功。现在再次放回这个文件src/main/java/com/XXXX/instrument/InstrumentFrame.java并再次运行分析它会成功使用src/main/java/com/XXXX/instrument/InstrumentFrame.java文件。不知道为什么,但无论如何都会发生这种情况它已经解决了我的问题。

干杯!

于 2017-04-19T10:49:36.607 回答
0

为了更清楚地作为答案而不是评论:

您必须停止 SonarQube 并删除该data/es目录。

于 2016-09-07T14:04:43.343 回答