Hello,
we have a problem with java sonar analisys using gradle and bamboo. It doesn’t find coverage report. It shows coverage always as 0.
Below are necessary details
Gradle sonarqube plugin:
id “org.sonarqube” version “3.0”
java version “1.8”
Our gradle properties:
sonarqube {
properties {
property “sonar.host.url”, "http://sonar.xxxx
.com:8080"
property "sonar.projectName", project.name
property "sonar.projectVersion", version
property "sonar.projectKey", project.name
property 'sonar.exclusions', '**/*ReportingApplication**, **/*EnvironmentPreparedListener**, **/model/**, **/exception/**, **/mappers/**,**/*StoredProcedure.**,**/gen/**'
property "sonar.coverage.jacoco.xmlReportPaths", "${project.buildDir}/reports/jacoco.xml"
}
}
Jacoco configuration:
test{
finalizedBy jacocoTestReport
}
jacocoTestReport{
dependsOn test
}
jacoco{
toolVersion = “0.8.5”
}
jacocoTestReport {
reports {
xml.enabled true
csv.enabled false
//to create coverage report in html
html.destination file(“${buildDir}/reports/coverage”)
//for XML
xml.destination file(“${buildDir}/reports/jacoco.xml”)
}
}
LOGS of sonarTask:
build 28-Dec-2023 00:48:02 > Task :sonarqube
build 28-Dec-2023 00:48:02 Sensor FindBugs Sensor [findbugs] (done) | time=5836ms
build 28-Dec-2023 00:48:02 Sensor SurefireSensor [java]
build 28-Dec-2023 00:48:02 parsing [/usr/appl/cie/home/prodcie/bamboo-agent-5/bamboo-home/xml-data/build-dir/JOB1/build/test-results/test]
build 28-Dec-2023 00:48:02 Sensor SurefireSensor [java] (done) | time=56ms
build 28-Dec-2023 00:48:02 Sensor JaCoCoSensor [java]
build 28-Dec-2023 00:48:02 Both ‘sonar.jacoco.reportPath’ and ‘sonar.coverage.jacoco.xmlReportPaths’ were set. ‘sonar.jacoco.reportPath’ is deprecated therefore, only ‘sonar.coverage.jacoco.xmlReportPaths’ will be taken into account.
build 28-Dec-2023 00:48:02 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.
build 28-Dec-2023 00:48:02 Sensor JaCoCoSensor [java] (done) | time=1ms
build 28-Dec-2023 00:48:02 Sensor JavaXmlSensor [java]
build 28-Dec-2023 00:48:02 Sensor JavaXmlSensor [java] (done) | time=1ms
build 28-Dec-2023 00:48:02 Sensor Analyzer for “php.ini” files [php]
build 28-Dec-2023 00:48:02 Sensor Analyzer for “php.ini” files [php] (done) | time=3ms
build 28-Dec-2023 00:48:02 Sensor Zero Coverage Sensor
build 28-Dec-2023 00:48:02 Sensor Zero Coverage Sensor (done) | time=26ms