This is a SpringBoot
project based on gradle build
tool and I am using AzureDevOps
task for SonarQube
Analysis.
Here are the properties I added in task:
sonar.java.binaries=build\classes
sonar.jacoco.reportPaths=build\jacoco\test.exec
sonar.language=java
sonar.tests=src\test\java
sonar.verbose=false
sonar.test.inclusions=**\test\**
It was working fine few days back and today suddenly it started failing with the error that 0 % code coverage.
When I compared the logs from successful and failure build I found this message in failed build.
INFO: Sensor JaCoCoSensor [java]
INFO: Both 'sonar.jacoco.reportPaths' and 'sonar.coverage.jacoco.xmlReportPaths' were set. 'sonar.jacoco.reportPaths' is deprecated therefore, only 'sonar.coverage.jacoco.xmlReportPaths' will be taken into account.
But I haven't configured anything specific to xmlReportPaths
so not sure why it started failing.
gradle version- 5.4.1
SonarQube Scanner version- 3.3.0.1492
SonarQube server version- 7.3.0
Any help is appreciated.
After struggling for few days and searching internet I finally found the mistake I did with my gradle task.
I had enabled html
and xml
both reports which was caused the mention issue.
set the xml.enabled
to false
and it started working like before.
jacocoTestReport{
additionalSourceDirs.from = files(sourceSets.main.allJava.srcDirs)
reports {
html.enabled true
xml.enabled false
csv.enabled false
html.destination file("build/reports/jacoco/html")
}
executionData.from = files('build/jacoco/test.exec')
}
But still I am not sure how it worked first time, because as I said earlier I didn't make any change in code or pipeline.
I saw that regarding the same message Sonarqube is working on a story as well.