2013-12-20 67 views
4

我已經在聲納之外生成了cobertura的覆蓋報告,並希望「重複使用」它們並將它們導入Sonar。這可能嗎。Sonar-runner沒有導入Groovy/Grails項目的cobertura coverage.xml報告

聲納3.73 聲納入門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 [email protected] 
15:47:13.041 INFO - The file null does not exist 
15:47:13.041 INFO - Sensor [email protected] done: 0 ms 
15:47:13.470 INFO - Execute decorators... 

想法。

+2

這可能的情況下,在下面的線程描述:http://forums.gradle.org/gradle/topics/code_coverage_reports_cobertura_jacoco_are_not_being_pushed_to_sonar。 https://jira.codehaus.org/browse/SONARPLUGINS-2127的解決方法是使用來自https://github.com/Spantree/sonar-groovy的Sonar Groovy插件的補丁版本。 –

+0

不幸的是,他們的插件沒有任何改變。有人必須以可重現的方式進行工作。 –

+0

您確定您使用Spantree回購的快照版本(複製內置-1.0-spantree-SNAPSHOT.jar到您的Sonar擴展目錄中)嗎?您是否注意到日誌中的Cobertura傳感器?如果該版本沒有變化,您可以在SONARPLUGINS-2127中發表評論,告訴作者仍然有問題。 –

回答

0

嘗試增加此塊到你BuildConfig.groovy

coverage { 
    xml = true 
} 
+0

coverage.xml文件存在,所以我不認爲這是問題。這個問題最終是在聲納處決之前,乾淨地運行並移走了文件。 –

1

嘗試使用cobetura reportpath性質的絕對路徑。對於Windows中,你可以嘗試使用下面的

sonar.cobertura.reportPath=\\target\\test-reports\\cobertura\\coverage.xml

0

您需要使用正確的屬性鍵指定覆蓋XML報告路徑:

sonar.groovy.cobertura.reportPath=target/test-reports/cobertura/coverage.xml 
相關問題