我已将SonarQube从3.2.1升级到SonarQube 4.2。此外,我已将C#插件从1.4升级到3.3。我们正在使用Sonar runner 2.0。此外,我们已将Visual Studio的Analysis Bootstrapper设置为TRUE。
升级后,我在大多数版本中面临以下错误:
但是,我们收到以下错误
"Exception in thread "main" org.sonar.runner.RunnerException: 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".
我们已将sonar.visualstudio.enable = true以及sonar.cs.fxcop.assembly添加到sonar.properties文件中。
我们还在sonar-project.properties中设置了fxcopcmd.exe路径,在sonar-runner.properties中设置了路径,并在C#插件下设置了sonarqube。
编辑:
Exception in thread "main" org.sonar.runner.RunnerException: 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.runner.Runner.delegateExecution(Runner.java:288)
○at org.sonar.runner.Runner.execute(Runner.java:151)
○at org.sonar.runner.Main.execute(Main.java:84)
○at org.sonar.runner.Main.main(Main.java:56)
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:94)
○at org.sonar.plugins.fxcop.FxCopConfiguration.checkProperties(FxCopConfiguration.java:86)
○at org.sonar.plugins.fxcop.FxCopSensor.analyse(FxCopSensor.java:91)
○at org.sonar.plugins.fxcop.FxCopSensor.analyse(FxCopSensor.java:86)
○at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:79)
○at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:70)
○at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:134)
○at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:186)
○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:199)
○at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:194)
○at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:192)
○at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:187)
○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:56)
○at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:44)
○at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:82)
○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.BootstrapContainer.executeTask(BootstrapContainer.java:144)
○at org.sonar.batch.bootstrap.BootstrapContainer.doAfterStart(BootstrapContainer.java:132)
○at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
○at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
○at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:92)
○at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:74)
○at org.sonar.batch.Batch.execute(Batch.java:103)
提前致谢
答案 0 :(得分:1)
SonarQube 4.2早于长期支持版本4.5.x,这意味着它不再受支持。我强烈建议您升级到SonarQube LTS版本,并使用最新的C#插件以及与Microsoft共同开发的MSBuild SonarQube Runner,这将使.NET项目的分析变得简单易行。 MSBuild SonarQube Runner本身支持FxCop。
关于您所面临的错误,您应该在分析开始时查看声纳 - 跑步者日志:它将告诉Visual Studio Bootstrapper插件为您的每个项目找到哪些程序集。当然,这些项目实际上需要为找到的组件而构建!摆脱此错误的最简单方法是禁用质量配置文件中的所有FxCop规则。
答案 1 :(得分:0)
您应该从“Visual Studio 2013或更高版本的开发人员命令提示符(http://docs.sonarqube.org/display/SONAR/Analyzing+with+SonarQube+Scanner+for+MSBuild)运行命令。