【发布时间】:2016-03-19 04:05:45
【问题描述】:
我正在使用 SonarQube 5.1.2 与 C# Plugin 4.2 和由 Jenkins 执行的 MSBuild Sonar Runner 1.0.1。
运行分析时出现以下错误:
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.IllegalArgumentException: The property "sonar.cs.fxcop.assembly" must be set and the project must have been built to execute FxCop rules. This property can be automatically set by the Analysis Bootstrapper for Visual Studio Projects plugin, see: http://docs.codehaus.org/x/TAA1Dg.If you wish to skip the analysis of not built projects, set the property "sonar.visualstudio.skipIfNotBuilt".
at org.sonar.plugins.fxcop.FxCopConfiguration.checkMandatoryProperties(FxCopConfiguration.java:105)
at org.sonar.plugins.fxcop.FxCopConfiguration.checkProperties(FxCopConfiguration.java:96)
at org.sonar.plugins.fxcop.FxCopSensor.analyse(FxCopSensor.java:92)
at org.sonar.plugins.fxcop.FxCopSensor.analyse(FxCopSensor.java:87)
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(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
... 9 more
我看到另一个类似问题的踏板,他们的解决方案是从路径中删除单词 test。我的路径没有“测试”这个词。
不知道下一步该做什么。
【问题讨论】:
-
你能告诉你在 Jenkins 中启动 SonarQube 分析的步骤吗?
-
1. D:\MSBuild.SonarQube.Runner-1.0.2\MSBuild.SonarQube.Runner.exe 开始 /k:"foo" /n:"foo" /v:"1.0" /d:sonar.resharper.cs.reportPath= "D:\TestResults\resharper.xml" /d:sonar.resharper.solutionFile="Solutions\foo.sln"
-
2.我使用 msbuild 插件来构建解决方案。我为配置和平台传入 msbuild 属性。
-
3. D:\JetBrains.ReSharper.CommandLineTools\inspectcode.exe /output="D:\TestResults\resharper.xml" "Solutions\foo.sln"
-
4. D:\MSBuild.SonarQube.Runner-1.0.2\MSBuild.SonarQube.Runner.exe 结束
标签: sonarqube sonarqube-msbuild-runner