我正在尝试使用声纳来分析我的解决方案(C#.NET)。不幸的是,在插件加载后,它失败了以下的堆栈跟踪:
14:53:19.646 DEBUG - Release semaphore on project : org.sonar.api.resources.Project@7f9b2bab[id=3169,key=com.exigenservices:cm,qualifier=TRK], with key batch-com.exigenservices:cm
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 2:12.629s
Final Memory: 13M/405M
ERROR: Error during Sonar runner execution
INFO: ------------------------------------------------------------------------
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:90)
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:41)
Caused by: java.util.NoSuchElementException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:929)
at java.util.HashMap$ValueIterator.next(HashMap.java:954)
at org.sonar.dotnet.tools.commons.visualstudio.VisualStudioProject.getArtifactDirectory(VisualStudioProject.java:178)
at org.sonar.dotnet.tools.commons.visualstudio.VisualStudioProject.getArtifact(VisualStudioProject.java:195)
at org.sonar.dotnet.tools.commons.visualstudio.VisualStudioProject.getGeneratedAssemblies(VisualStudioProject.java:209)
at org.sonar.plugins.csharp.api.sensor.AbstractRegularCSharpSensor.assembliesFound(AbstractRegularCSharpSensor.java:101)
at org.sonar.plugins.csharp.api.sensor.AbstractRegularCSharpSensor.shouldExecuteOnProject(AbstractRegularCSharpSensor.java:81)
at org.sonar.plugins.csharp.api.sensor.AbstractRuleBasedCSharpSensor.shouldExecuteOnProject(AbstractRuleBasedCSharpSensor.java:48)
at org.sonar.batch.bootstrap.BatchExtensionDictionnary.shouldKeep(BatchExtensionDictionnary.java:62)
at org.sonar.batch.bootstrap.BatchExtensionDictionnary.getFilteredExtensions(BatchExtensionDictionnary.java:52)
at org.sonar.batch.bootstrap.BatchExtensionDictionnary.select(BatchExtensionDictionnary.java:42)
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:63)
at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:114)
at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:150)
实际上在声纳缓存(.sonar
)目录中显示了以下插件:
checkstyle
core
cpd
csharp
csharpfxcop
csharpgallio
csharpgendarme
csharpndeps
csharpsquid
csharpstylecop
dbcleaner
design
emailnotifications
findbugs
jacoco
java
l10nen
mavenbatch
pmd
squidjava
surefire
不幸的是我没有任何想法来解决它,并且由于声纳调试消息的不足而导致问题出在哪里。
答案 0 :(得分:1)
SonarQube的.Net插件中的Visual Studio项目解析器希望使用此xpath找到输出文件:
"/vst:Project/vst:PropertyGroup[contains(@Condition,'" + config + "')]/vst:OutputPath"
其中config
是它确定应该使用的构建配置。
从我所看到的current source code以及你提供的异常堆栈跟踪(它没有准确排列),我会在这一行上抛出异常:
if (artifactDirectory == null) {
// just take the first one found...
artifactDirectory = buildConfOutputDirMap.values().iterator().next();
这意味着它无法为您的项目找到任何构建输出。
如果您发现您的csproj文件具有OutputPath的不同位置,请向SonarQube user mailing list提交错误报告,以便将来修复它。
答案 1 :(得分:0)
这意味着项目的CSPROJ文件不正确,并且缺少有关生成程序集的工件目录的一些信息。