Sonar Cobertura Plugin not finding coverage.xml file

user3472205 picture user3472205 · Jun 10, 2014 · Viewed 15.7k times · Source

I have a multi-module maven project in Jenkins 1.545.I am using Sonarqube version 4.2.I have installed cobertura plugin version 1.6.1 and java plugin version 2.2.1 in Sonarqube.I have successfully generated coverage.xml file at location- /target/site/cobertura/coverage.xml for each module using maven command- "cobertura:cobertura -Dcobertura.report.format=xml" For sonar,i have set the maven build option as sonar:sonar with properties as below:

sonar.dynamicAnalysis=reuseReports
sonar.junit.reportsPath=target/site
sonar.java.coveragePlugin=cobertura
sonar.cobertura.reportPath=/target/site/cobertura/coverage.xml

I can see coverage.xml file when I browse the workspace of my project in Jenkins but the plugin keeps saying that it can't find it.I get the following message in console output of jenkins-

Execute Findbugs 2.0.3 done: 48446 ms
Sensor FindbugsSensor done: 48800 ms
Sensor CoberturaSensor...
Cobertura report not found at /target/site/cobertura/coverage.xml
Sensor CoberturaSensor done: 4 ms
Sensor CpdSensor...

Any help is appreciated.Thanks in advance.

Answer

user2806909 picture user2806909 · Aug 7, 2014

I had the same issue (SonarQube 4.4., Cobertura 1.6.2, Jenkins + maven + java8) and I just finally figured out solution for the problem:

sonar.cobertura.reportPath=target/site/cobertura/coverage.xml

Notice the missing "/" from the beginning of the path!

It actually tried to search from absolute root directory in my Linux server.