SonarQube:无法为包含
本文关键字:创建 度量 文件 包含 SonarQube | 更新日期: 2023-09-27 18:36:16
我们最近将SonarQube服务器升级到最新版本(5.3),并升级了所有插件。服务器目前只监视由Visual Studio Team Services(Visual Studio Online)构建的C#项目的单个构建。
起初,一切都运行良好(除了一个长期存在的问题,我将在另一个问题中描述)。但是过了一段时间,我们在尝试将数据推送到 SQ 时开始出现如下错误:
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:100)
at org.sonar.runner.Main.executeTask(Main.java:70)
at org.sonar.runner.Main.execute(Main.java:59)
at org.sonar.runner.Main.main(Main.java:53)
Caused by: java.lang.IllegalStateException: Can't create measure for line 47 for file '[PATH]/[FILENAME].cs' with 45 lines
at org.sonar.batch.sensor.coverage.CoverageExclusions.validateMaxLine(CoverageExclusions.java:158)
at org.sonar.batch.sensor.coverage.CoverageExclusions.validate(CoverageExclusions.java:129)
at org.sonar.batch.deprecated.DeprecatedSensorContext.saveMeasure(DeprecatedSensorContext.java:204)
at org.sonar.plugins.dotnet.tests.CoverageReportImportSensor.analyze(CoverageReportImportSensor.java:78)
at org.sonar.plugins.dotnet.tests.CoverageReportImportSensor.analyse(CoverageReportImportSensor.java:59)
at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58)
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:50)
at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:98)
at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:185)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:132)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:117)
at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:243)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:238)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:236)
at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:228)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:132)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:117)
at org.sonar.batch.task.ScanTask.execute(ScanTask.java:55)
at org.sonar.batch.task.TaskContainer.doAfterStart(TaskContainer.java:86)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:132)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:117)
at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:122)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:119)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:79)
at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
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:497)
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
... 9 more
我们找到了一篇文章(https://groups.google.com/forum/#!topic/sonarqube/Xju6ichZe_k),它描述了一个解决方案,涉及更改其中一个插件(sonar-dotnet-tests-library)的代码并替换服务器上的构建文件。存在。NET-heads,我们不介意不必修改其他人的Java库来使其工作;)
这是问题的解决方案,还是其他可能导致此问题的原因?目前,它阻止我们将数据推送到 SonarQube,这是一种耻辱......
Visual Studio 2015附带的代码覆盖率工具中似乎存在问题。此问题应使用 Visual Studio 2015 Update 3 修复。
托管代理在发布后不久也应使用 Update 3 进行更新,TFS 构建团队在这方面非常快。有关托管代理上可用软件的列表,请参阅此处。
在此之前的解决方法:
- 不生成代码覆盖率文件,例如通过禁用 VS 测试生成任务中的选项
- 一些用户报告说VS 2013没有出现问题,因此您可能希望使用它进行构建和/或测试,而不是使用VS 2015
对我来说,这是因为以前版本的OpenCover报告被留在了Jenkins上。
一旦我确保它们都被删除,问题就消失了,我认为有多个报告意味着它试图多次处理文件。
本文关键字:创建 度量 文件 包含 SonarQube | 更新日期: 2023-09-27 18:36:16
我们最近将SonarQube服务器升级到最新版本(5.3),并升级了所有插件。服务器目前只监视由Visual Studio Team Services(Visual Studio Online)构建的C#项目的单个构建。
起初,一切都运行良好(除了一个长期存在的问题,我将在另一个问题中描述)。但是过了一段时间,我们在尝试将数据推送到 SQ 时开始出现如下错误:
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:100)
at org.sonar.runner.Main.executeTask(Main.java:70)
at org.sonar.runner.Main.execute(Main.java:59)
at org.sonar.runner.Main.main(Main.java:53)
Caused by: java.lang.IllegalStateException: Can't create measure for line 47 for file '[PATH]/[FILENAME].cs' with 45 lines
at org.sonar.batch.sensor.coverage.CoverageExclusions.validateMaxLine(CoverageExclusions.java:158)
at org.sonar.batch.sensor.coverage.CoverageExclusions.validate(CoverageExclusions.java:129)
at org.sonar.batch.deprecated.DeprecatedSensorContext.saveMeasure(DeprecatedSensorContext.java:204)
at org.sonar.plugins.dotnet.tests.CoverageReportImportSensor.analyze(CoverageReportImportSensor.java:78)
at org.sonar.plugins.dotnet.tests.CoverageReportImportSensor.analyse(CoverageReportImportSensor.java:59)
at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58)
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:50)
at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:98)
at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:185)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:132)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:117)
at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:243)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:238)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:236)
at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:228)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:132)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:117)
at org.sonar.batch.task.ScanTask.execute(ScanTask.java:55)
at org.sonar.batch.task.TaskContainer.doAfterStart(TaskContainer.java:86)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:132)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:117)
at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:122)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:119)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:79)
at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
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:497)
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
... 9 more
我们找到了一篇文章(https://groups.google.com/forum/#!topic/sonarqube/Xju6ichZe_k),它描述了一个解决方案,涉及更改其中一个插件(sonar-dotnet-tests-library)的代码并替换服务器上的构建文件。存在。NET-heads,我们不介意不必修改其他人的Java库来使其工作;)
这是问题的解决方案,还是其他可能导致此问题的原因?目前,它阻止我们将数据推送到 SonarQube,这是一种耻辱......
Visual Studio 2015附带的代码覆盖率工具中似乎存在问题。此问题应使用 Visual Studio 2015 Update 3 修复。
托管代理在发布后不久也应使用 Update 3 进行更新,TFS 构建团队在这方面非常快。有关托管代理上可用软件的列表,请参阅此处。
在此之前的解决方法:
- 不生成代码覆盖率文件,例如通过禁用 VS 测试生成任务中的选项
- 一些用户报告说VS 2013没有出现问题,因此您可能希望使用它进行构建和/或测试,而不是使用VS 2015
对我来说,
这是因为以前版本的OpenCover报告被留在了Jenkins上。
一旦我确保它们都被删除,问题就消失了,我认为有多个报告意味着它试图多次处理文件。