我已经在声纳之外用cobertura生成了覆盖率报告,并希望“重用”它们并将它们导入Sonar。这可能。
声纳3.73 Sonar-Runner 2.3
sonar.projectKey=org.me:artifactname
sonar.projectName=Project Name
sonar.projectVersion=1.0
sonar.sources=src/groovy, grails-app
sonar.language=grvy
sonar.sourceEncoding=UTF-8
sonar.tests=test/unit
sonar.dynamicAnalysis=reuseReports
sonar.core.codeCoveragePlugin=cobertura
sonar.cobertura.reportPath=target/test-reports/cobertura/coverage.xml
sonar.surefire.reportsPath=target/test-reports
sonar.grvy.coveragePlugin=cobertura
coverage.xml文件确实存在且位于该路径中。我已经检查了100次。
单位测试成功信息在声纳中填写,但单位测试覆盖率为破折号,为空白。
其他所有内容都是填充的,复杂性,代码行......
这是输出的一部分。
15:47:10.837 INFO - Load module settings
15:47:11.085 INFO - Quality profile : [name=Sonar way,language=grvy]
15:47:11.103 INFO - Excluded tests:
15:47:11.104 INFO - **/package-info.java
15:47:11.143 INFO - Configure Maven plugins
15:47:11.176 INFO - Compare to previous analysis (2013-12-20)
15:47:11.210 INFO - Compare over 30 days (2013-11-20, analysis of 2013-12-19 15:41:26.0)
15:47:11.219 INFO - Compare to previous version
15:47:11.648 INFO - Base dir: /Users/Shared/Jenkins/Home/jobs/Grails-Sample-Master/workspace
15:47:11.648 INFO - Working dir: /Users/Shared/Jenkins/Home/jobs/Grails-Sample-Master/workspace/.sonar
15:47:11.648 INFO - Source dirs: /Users/Shared/Jenkins/Home/jobs/Grails-Sample-Master/workspace/src/groovy
15:47:11.648 INFO - Source encoding: UTF-8, default locale: en_US
15:47:11.662 INFO - Sensor GroovySourceImporter...
15:47:11.761 INFO - Sensor GroovySourceImporter done: 99 ms
15:47:11.761 INFO - Sensor CpdSensor...
15:47:11.761 INFO - SonarBridgeEngine is used
15:47:11.763 INFO - Cross-project analysis disabled
15:47:11.840 INFO - Sensor CpdSensor done: 79 ms
15:47:11.841 INFO - Sensor GroovySensor...
15:47:12.855 INFO - GMetrics completed: 591ms
15:47:12.879 INFO - Sensor GroovySensor done: 1038 ms
15:47:12.879 INFO - Sensor Groovy SurefireSensor...
15:47:12.881 INFO - parsing /Users/Shared/Jenkins/Home/jobs/Grails-Sample-Master/workspace/target/test-reports
15:47:12.978 INFO - Sensor Groovy SurefireSensor done: 99 ms
15:47:12.978 INFO - Sensor InitialOpenIssuesSensor...
15:47:12.983 INFO - Sensor InitialOpenIssuesSensor done: 5 ms
15:47:12.983 INFO - Sensor ProfileSensor...
15:47:12.993 INFO - Sensor ProfileSensor done: 10 ms
15:47:12.993 INFO - Sensor ProfileEventsSensor...
15:47:13.019 INFO - Sensor ProfileEventsSensor done: 26 ms
15:47:13.019 INFO - Sensor ProjectLinksSensor...
15:47:13.028 INFO - Sensor ProjectLinksSensor done: 9 ms
15:47:13.029 INFO - Sensor VersionEventsSensor...
15:47:13.041 INFO - Sensor VersionEventsSensor done: 12 ms
15:47:13.041 INFO - Sensor org.sonar.plugins.artifactsize.ArtifactSizeSensor@52156251...
15:47:13.041 INFO - The file null does not exist
15:47:13.041 INFO - Sensor org.sonar.plugins.artifactsize.ArtifactSizeSensor@52156251 done: 0 ms
15:47:13.470 INFO - Execute decorators...
思考。
答案 0 :(得分:1)
尝试使用cobertura reportpath属性的绝对路径。对于Windows框,您可以尝试使用以下
sonar.cobertura.reportPath=\\target\\test-reports\\cobertura\\coverage.xml
答案 1 :(得分:0)
尝试将此块添加到BuildConfig.groovy
coverage {
xml = true
}
答案 2 :(得分:0)
您需要使用正确的属性键来指定coverage xml报告路径:
sonar.groovy.cobertura.reportPath=target/test-reports/cobertura/coverage.xml