【问题标题】:SonarQube runner throws org.sonar.runner.impl.RunnerExceptionSonarQube 跑步者抛出 org.sonar.runner.impl.RunnerException
【发布时间】:2015-09-09 14:16:16
【问题描述】:

当我尝试在未安装 Visual Studio 的机器上分析 .Net/C# 项目时,SonarQube 运行器抛出 org.sonar.runner.impl.RunnerException。

这里是日志sn-p:

[21:51:53][Step 2/2] 16:21:53.582 INFO  - Sensor org.sonar.plugins.csharp.CSharpSensor@2f63ef53
[21:51:53][Step 2/2] 16:21:53.764 ERROR - 
[21:51:53][Step 2/2] 16:21:53.767 ERROR - Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
[21:51:53][Step 2/2] 16:21:53.767 ERROR -    at SonarQube.CSharp.CodeAnalysis.Runner.Program.Main(String[] args)
[21:51:55][Step 2/2] INFO: ------------------------------------------------------------------------
[21:51:55][Step 2/2] INFO: EXECUTION FAILURE
[21:51:55][Step 2/2] INFO: ------------------------------------------------------------------------
[21:51:55][Step 2/2] Total time: 9.837s
[21:51:55][Step 2/2] ERROR: Error during Sonar runner execution
[21:51:55][Step 2/2] Final Memory: 23M/637M
[21:51:55][Step 2/2] INFO: ------------------------------------------------------------------------
[21:51:55][Step 2/2] ERROR: Unable to execute Sonar
[21:51:55][Step 2/2] ERROR: Caused by: The .NET analyzer failed with exit code: 255
[21:51:55][Step 2/2] ERROR: 
[21:51:55][Step 2/2] ERROR: To see the full stack trace of the errors, re-run SonarQube Runner with the -e switch.
[21:51:55][Step 2/2] ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
[21:51:55][Step 2/2] Process exited with code 1

运行 sonar-runner -e 时的输出

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: The .NET analyzer failed with exit code: -532462766
        at org.sonar.plugins.csharp.CSharpSensor.analyze(CSharpSensor.java:160)
        at org.sonar.plugins.csharp.CSharpSensor.analyse(CSharpSensor.java:102)
        at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:59)
        at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:51)
        at org.sonar.batch.phases.DatabaseModePhaseExecutor.execute(DatabaseModePhaseExecutor.java:120)
        at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:264)
        at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
        at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
        at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:235)
        at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:230)
        at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:228)
        at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:220)
        at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
        at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
        at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:57)
        at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:45)
        at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:135)
        at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
        at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
        at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:158)
        at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:95)
        at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
        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)

分析 C# 代码是否需要 Visual Studio?

【问题讨论】:

    标签: c# visual-studio teamcity sonarqube sonar-runner


    【解决方案1】:

    Visual Studio 不需要分析 C# 代码,但是您需要最近的 .Net 运行时 (4.5 as of writing)。

    您可能还想看看newer integration with TFS and MSBuild

    【讨论】:

      猜你喜欢
      • 2013-03-10
      • 1970-01-01
      • 2015-11-04
      • 1970-01-01
      • 2021-08-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-27
      相关资源
      最近更新 更多