从一个特定解决方案导入Coverage结果时,我发现错误。其他人似乎工作正常。我一直在使用C#插件的5.1版,我刚试过5.2 RC,但我仍然看到同样的问题。
错误似乎与源文件相关,其中行数少于coverage文件似乎表明的行数。我在这里引用了一个类似的问题,看起来已经解决了,但不适合我......;
https://groups.google.com/forum/#!topic/sonarqube/Xju6ichZe_k
您可以提供的任何帮助或指导都会非常感激,因为这是我从SonarQube获取有用信息的最后一步。
错误是;
java.lang.IllegalStateException:无法为第12行创建度量 文件 ' E:/b/3/_work/25/s/Maples.eServices.UI/Maples.eServices.UI.Services/TodayNotification/AggregatedEmailModels/ContactWithChanges.cs' 有9行
2016-04-25T18:42:08.8051671Z 19:42:08.617 INFO - 传感器 org.sonar.plugins.csharp.CSharpSensor(已完成)|时间= 3703ms
2016-04-25T18:42:08.8051671Z 19:42:08.617 INFO - 传感器 org.sonar.plugins.csharp.CSharpCodeCoverageProvider $ CSharpCoverageReportImportSensor 2016-04-25T18:42:08.8051671Z 19:42:08.617 INFO - 解析视觉 Studio coverage XML报告 E:\ b \ 3_work \ 25 \ TestResults \ svctfsbuild_KYTFS15BLD02 2016-04-25 19_38_27 \ In \ KYTFS15BLD02 \ svctfsbuild_KYTFS15BLD02 2016-04-25 19_37_19.coveragexml 2016-04-25T18:42:08.9145352Z 19:42:08.773 INFO - 将此代码覆盖率报告添加到缓存中以供以后重用:E:\ b \ 3_work \ 25 \ TestResults \ svctfsbuild_KYTFS15BLD02 2016-04-25 19_38_27 \ In \ KYTFS15BLD02 \ svctfsbuild_KYTFS15BLD02 2016-04-25 19_37_19.coveragexml 2016-04-25T18:42:09.5707468Z信息:2016-04-25T18:42:09.5707468Z信息:执行失败
2016-04-25T18:42:09.5707468Z信息:2016-04-25T18:42:09.5707468Z总时间:1:30.185s
2016-04-25T18:42:09.6801267Z最终记忆:10M / 235M
2016-04-25T18:42:09.6801267Z信息:2016-04-25T18:42:09.6801267Z ## [错误]错误:Sonar runner期间出错 执行2016-04-25T18:42:09.6801267Z ## [错误] org.sonar.runner.impl.RunnerException:无法执行Sonar 2016-04-25T18:42:09.6801267Z ## [错误] at at org.sonar.runner.impl.BatchLauncher $ 1.delegateExecution(BatchLauncher.java:91) 2016-04-25T18:42:09.6801267Z ## [错误] at org.sonar.runner.impl.BatchLauncher $ 1.run(BatchLauncher.java:75)
2016-04-25T18:42:09.6801267Z ## [错误] at java.security.AccessController.doPrivileged(原生方法)
2016-04-25T18:42:09.6801267Z ## [错误] at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69) 2016-04-25T18:42:09.6801267Z ## [错误] at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
2016-04-25T18:42:09.6801267Z ## [错误] at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102) 2016-04-25T18:42:09.6801267Z ## [错误] at org.sonar.runner.api.Runner.execute(Runner.java:100)
2016-04-25T18:42:09.6801267Z ## [错误] at org.sonar.runner.Main.executeTask(Main.java:70)
2016-04-25T18:42:09.6801267Z ## [错误] at org.sonar.runner.Main.execute(Main.java:59)
2016-04-25T18:42:09.6801267Z ## [错误] at org.sonar.runner.Main.main(Main.java:53)
2016-04-25T18:42:09.6801267Z ## [错误]引起: java.lang.IllegalStateException:无法为第12行创建度量 文件 ' E:/b/3/_work/25/s/Maples.eServices.UI/Maples.eServices.UI.Services/TodayNotification/AggregatedEmailModels/ContactWithChanges.cs' 9行2016-04-25T18:42:09.6801267Z ## [错误] at org.sonar.batch.sensor.coverage.CoverageExclusions.validateMaxLine(CoverageExclusions.java:158) 2016-04-25T18:42:09.6801267Z ## [错误] at org.sonar.batch.sensor.coverage.CoverageExclusions.validate(CoverageExclusions.java:129) 2016-04-25T18:42:09.6801267Z ## [错误] at org.sonar.batch.deprecated.DeprecatedSensorContext.saveMeasure(DeprecatedSensorContext.java:204) 2016-04-25T18:42:09.6801267Z ## [错误] at org.sonar.plugins.dotnet.tests.CoverageReportImportSensor.analyze(CoverageReportImportSensor.java:103) 2016-04-25T18:42:09.6801267Z ## [错误] at org.sonar.plugins.dotnet.tests.CoverageReportImportSensor.analyse(CoverageReportImportSensor.java:74) 2016-04-25T18:42:09.6801267Z ## [错误] at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58) 2016-04-25T18:42:09.6801267Z ## [错误] at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:50) 2016-04-25T18:42:09.6801267Z ## [错误] at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:102)
2016-04-25T18:42:09.6801267Z ## [错误] at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:185) 2016-04-25T18:42:09.6801267Z ## [错误] at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135) 2016-04-25T18:42:09.6801267Z ## [错误] at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:120) 2016-04-25T18:42:09.6801267Z ## [错误] at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:264) 2016-04-25T18:42:09.6801267Z ## [错误] at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:259) 2016-04-25T18:42:09.6801267Z ## [错误] at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:257) 2016-04-25T18:42:09.6801267Z ## [错误] at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:249) 2016-04-25T18:42:09.6801267Z ## [错误] at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135) 2016-04-25T18:42:09.6801267Z ## [错误] at org.sonar.batch.scan.ProjectScanContainer.startComponents(ProjectScanContainer.java:127) 2016-04-25T18:42:09.6801267Z ## [错误] at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:120) 2016-04-25T18:42:09.6801267Z ## [错误] at org.sonar.batch.task.ScanTask.execute(ScanTask.java:55)
2016-04-25T18:42:09.6801267Z ## [错误] at org.sonar.batch.task.TaskContainer.doAfterStart(TaskContainer.java:86) 2016-04-25T18:42:09.6801267Z ## [错误] at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135) 2016-04-25T18:42:09.6801267Z ## [错误] at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:120) 2016-04-25T18:42:09.6801267Z ## [错误] at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:122) 2016-04-25T18:42:09.6957435Z ## [错误] at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:119)
2016-04-25T18:42:09.6957435Z ## [错误] at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:79)
2016-04-25T18:42:09.6957435Z ## [错误] at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48) 2016-04-25T18:42:09.6957435Z ## [错误] at sun.reflect.NativeMethodAccessorImpl.invoke0(原生方法)
2016-04-25T18:42:09.6957435Z ## [错误] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2016-04-25T18:42:09.6957435Z ## [错误] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2016-04-25T18:42:09.6957435Z ## [错误] at java.lang.reflect.Method.invoke(未知来源)
2016-04-25T18:42:09.6957435Z ## [错误] at org.sonar.runner.impl.BatchLauncher $ 1.delegateExecution(BatchLauncher.java:87) 2016-04-25T18:42:09.6957435Z ## [错误] ... 9更多
2016-04-25T18:42:09.6957435Z ## [错误]错误:
2016-04-25T18:42:09.6957435Z ## [错误]错误:重新运行SonarQube Runner 使用-X开关启用完整的调试日志记录 2016-04-25T18:42:09.6957435Z ## [错误] SonarQube扫描仪没有 顺利完成2016-04-25T18:42:09.6957435Z 19:42:09.617 创建摘要降价文件... 2016-04-25T18:42:09.6957435Z ## [错误]后处理失败。退出代码:1 2016-04-25T18:42:09.8207681Z ## [错误]收到意外退出代码 来自批处理文件:1
coveragexml
文件的相关部分是;
<function id="215992" token="0x6000cce" name="get_ContactId()" type_name="ContactWithChanges" block_coverage="0.00" line_coverage="0.00" blocks_covered="0" blocks_not_covered="3" lines_covered="0" lines_partially_covered="0" lines_not_covered="1">
<ranges>
<range source_id="213" covered="no" start_line="5" start_column="26" end_line="5" end_column="27" />
<range source_id="213" covered="no" start_line="5" start_column="28" end_line="5" end_column="32" />
</ranges>
</function>
<function id="216018" token="0x6000ccf" name="set_ContactId(int)" type_name="ContactWithChanges" block_coverage="0.00" line_coverage="0.00" blocks_covered="0" blocks_not_covered="3" lines_covered="0" lines_partially_covered="0" lines_not_covered="1">
<ranges>
<range source_id="213" covered="no" start_line="5" start_column="31" end_line="5" end_column="32" />
<range source_id="213" covered="no" start_line="5" start_column="33" end_line="5" end_column="37" />
</ranges>
</function>
<function id="216032" token="0x6000cd0" name="get_DisplayName()" type_name="ContactWithChanges" block_coverage="0.00" line_coverage="0.00" blocks_covered="0" blocks_not_covered="3" lines_covered="0" lines_partially_covered="0" lines_not_covered="1">
<ranges>
<range source_id="213" covered="no" start_line="5" start_column="33" end_line="5" end_column="37" />
</ranges>
</function>
<function id="216058" token="0x6000cd1" name="set_DisplayName(string)" type_name="ContactWithChanges" block_coverage="0.00" line_coverage="0.00" blocks_covered="0" blocks_not_covered="3" lines_covered="0" lines_partially_covered="0" lines_not_covered="14">
<ranges>
<range source_id="213" covered="no" start_line="6" start_column="36" end_line="6" end_column="37" />
<range source_id="213" covered="no" start_line="6" start_column="38" end_line="6" end_column="42" />
<range source_id="213" covered="no" start_line="14" start_column="7" end_line="20" end_column="10" />
</ranges>
</function>
<function id="216072" token="0x6000cd2" name="ContactWithChanges()" type_name="ContactWithChanges" block_coverage="0.00" line_coverage="0.00" blocks_covered="0" blocks_not_covered="4" lines_covered="0" lines_partially_covered="0" lines_not_covered="15">
<ranges>
<range source_id="213" covered="no" start_line="6" start_column="38" end_line="6" end_column="42" />
<range source_id="213" covered="no" start_line="12" start_column="5" end_line="12" end_column="41" />
<range source_id="213" covered="no" start_line="14" start_column="7" end_line="20" end_column="10" />
</ranges>
</function>
<source_file id="213" path="E:\b\3\_work\25\s\Maples.eServices.UI\Maples.eServices.UI.Services\TodayNotification\AggregatedEmailModels\ContactWithChanges.cs">
</source_file>
源代码是;
namespace Maples.eServices.UI.Services.TodayNotification.AggregatedEmailModels
{
public class ContactWithChanges
{
public int ContactId { get; set; }
public string DisplayName { get; set; }
}
}
答案 0 :(得分:0)
发生在我的团队,升级到sonarqube 6.2。 我们正在使用Jenkins构建并运行分析。 我擦掉工作区并重新运行工作,一切都再次成功运行。
随机猜测:
可能是由于覆盖扫描现在如何流畅(添加)。
取自source code
/**
* This class is used to report code coverage on files.
*
* Example:
*
* <pre>
* sensorContext.newCoverage().onFile(file)
.lineHits(1, 2)
.lineHits(2, 5)
.lineHits(3, 0)
. ...
.conditions(3, 4, 2)
.conditions(12, 2, 2)
. ...
.save();
*
* </pre>
*
* Since 6.2 you can save several reports for the same file and reports will be merged using the following "additive" strategy:
* <ul>
* <li>Line hits are cumulated</li>
* <li>We keep the max for condition coverage. Examples: 2/4 + 2/4 = 2/4, 2/4 + 3/4 = 3/4</li>
* </ul>
*
* @since 5.2