激活FXCop规则时,SonarQube扫描仪在内部部署TFS上失败

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了激活FXCop规则时,SonarQube扫描仪在内部部署TFS上失败相关的知识,希望对你有一定的参考价值。

当我在CI管道中运行声纳任务时,它会失败并显示消息

ERROR: Error during SonarQube Scanner execution
java.lang.IllegalArgumentException: No FxCop analysis has been performed on this project, whereas it contains cs files: Verify that you are using the latest version of the SonarQube Scanner for MSBuild, and if you do, please report a bug. In the short term, you can disable all FxCop rules from your quality profile to get rid of this error.
at org.sonar.plugins.fxcop.FxCopConfiguration.checkMandatoryProperties(FxCopConfiguration.java:104)
at org.sonar.plugins.fxcop.FxCopConfiguration.checkProperties(FxCopConfiguration.java:95)
at org.sonar.plugins.fxcop.FxCopSensor.execute(FxCopSensor.java:69)
at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:53)
at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:88)
at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:82)
at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:68)
at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:88)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:180)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:288)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:283)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:281)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:261)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48)
at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:84)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:121)
at org.sonar.batch.bootstrapper.Batch.doExecuteTask(Batch.java:116)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:111)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:63)
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.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:233)
at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151)
at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:123)
at org.sonarsource.scanner.cli.Main.execute(Main.java:77)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)

当我停用Sonar服务器上的所有FXCop规则时,它可以正常工作。当我激活FXCop规则并使用sonarqube扫描程序任务版本3.0.2时,它可以工作。

我错了什么?

TFS 2017 Update 3内部部署

构建代理2.122.1

SonarQube扫描仪3.1.0或3.0.2

SonarQube Server 6.7

谢谢

答案

尝试使用此处找到的fxcop插件的1.2版。 https://github.com/DanielHWe/sonar-fxcop/releases插件的那个版本摆脱了错误,但是在我的测试中我得到了向sonarqube报告的零fxcop规则违规。我目前正在测试TFS 2018和SonarQube 6.7。

以上是关于激活FXCop规则时,SonarQube扫描仪在内部部署TFS上失败的主要内容,如果未能解决你的问题,请参考以下文章

SonarQube 托管站点的常规设置下未显示 FXcop 选项

sonarqube怎么自定义Java代码规则

C# 的 Sonarqube 5.4 自定义规则

预览模式下的 SonarQube 线覆盖规则

使用单体项目的 Spotbugs 规则运行声纳扫描仪时出错?

协助 fxcop