我正在使用SONAR为.Net项目做POC。 我的第一次尝试是仅评估我的模拟测试的代码覆盖率。 到目前为止,我已经在我的沙盒(Win7)中安装了以下应用程序:
我的声纳网站托管在默认网址 localhost:9000 中,我可以在浏览器上看到。 我在我的sln文件所在的同一文件夹下创建了一个sonar-project.propeties文件 我的sonar-project.propeties看起来像这样:
# required metadata
sonar.projectKey=my:project
sonar.projectName=My project
sonar.projectVersion=1.0
sonar.sources=.
sonar.language=cs
当我在sane文件夹上执行sonar-runner时会出现问题,该文件夹会抛出以下错误消息:
INFO:--------------------------------------------- --------------------------- 信息:执行失败 信息:------------------------------------------------ ------------------------ 总时间:2.767秒 最终记忆:5M / 20M 信息:------------------------------------------------ ------------------------ 错误:Sonar跑步者执行期间出错 错误:无法执行声纳 错误:引起:您必须为“未知”定义以下强制属性 n':sonar.projectKey,sonar.projectName,sonar.projectVersion,sonar.sources 错误: 错误:要查看错误的完整堆栈跟踪,请使用t重新运行SonarQube Runner 他切换。 错误:使用-X开关重新运行SonarQube Runner以启用完整的调试日志记录。
知道可能导致这种情况的原因是什么? 我相信我没有遗漏任何东西。
当我用旗帜-e执行声纳转轮时,我得到以下信息:
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 20.841s
Final Memory: 12M/110M
INFO: ------------------------------------------------------------------------
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: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: org.sonar.api.utils.SonarException: Error while reading Gendarme resu
lt file: C:\Users\a-jose.valdes\Documents\Visual Studio 2012\Projects\PoC\NAFT
.PoC.Implementation\.sonar\gendarme-report.xml
at org.sonar.plugins.csharp.gendarme.results.GendarmeResultParser.parse(
GendarmeResultParser.java:105)
at org.sonar.plugins.csharp.gendarme.GendarmeSensor.analyseResults(Genda
rmeSensor.java:226)
at org.sonar.plugins.csharp.gendarme.GendarmeSensor.analyse(GendarmeSens
or.java:182)
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:7
2)
at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:114)
at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanConta
iner.java:142)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentCo
ntainer.java:92)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.
java:77)
at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.j
ava:187)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScan
Container.java:182)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScan
Container.java:180)
at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanCon
tainer.java:175)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentCo
ntainer.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.ja
va:82)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentCo
ntainer.java:92)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.
java:77)
at org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapCon
tainer.java:156)
at org.sonar.batch.bootstrap.BootstrapContainer.doAfterStart(BootstrapCo
ntainer.java:144)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentCo
ntainer.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.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java
:45)
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
Caused by: com.ctc.wstx.exc.WstxIOException: Unexpected first character (char co
de 0xEF), not valid in xml document: could be mangled UTF-8 BOM marker. Make sur
e that the Reader uses correct encoding or pass an InputStream instead
at com.ctc.wstx.io.ReaderBootstrapper.bootstrapInput(ReaderBootstrapper.
java:174)
at com.ctc.wstx.stax.WstxInputFactory.doCreateSR(WstxInputFactory.java:5
31)
at com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:585
)
at com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:641
)
at com.ctc.wstx.stax.WstxInputFactory.createXMLStreamReader(WstxInputFac
tory.java:323)
at org.codehaus.staxmate.SMInputFactory.createStax2Reader(SMInputFactory
.java:234)
at org.codehaus.staxmate.SMInputFactory.rootElementCursor(SMInputFactory
.java:337)
at org.sonar.plugins.csharp.gendarme.results.GendarmeResultParser.parse(
GendarmeResultParser.java:100)
... 39 more
ERROR:
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
答案 0 :(得分:2)
基于堆栈跟踪中的此消息:
Caused by: com.ctc.wstx.exc.WstxIOException: Unexpected first character (char co
de 0xEF), not valid in xml document: could be mangled UTF-8 BOM marker. Make sur
e that the Reader uses correct encoding or pass an InputStream instead
我建议您在sonar-project.properties
文件或sonar-runner.properties
文件中设置此属性:
sonar.sourceEncoding=UTF-8