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.
Cobertura always uses default value target/site/coverage. xml path when running Sonar Scanner. Which Sonar property should be used to specify multiple cobertura coverage.
Code coverage is directly calculated when you running the tests – each test you run will add coverage to your Java files.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With