3
votes

I run SonarQube on Bamboo build with gradlew command:

./gradlew -Dsonar.projectKey="${PROJECT_KEY}" -Dsonar.projectName="${PROJECT_NAME}" -Dsonar.branch.name="${bamboo_planRepository_1_branch}" -Dsonar.coverage.jacoco.xmlReportPaths=${TEST_REPORTS_PATH} :"${module}":testDebugUnitTest sonarqube

and there is no matter which TEST_REPORTS_PATH I use, I always get

No coverage report can be found with sonar.coverage.jacoco.xmlReportPaths='build/reports/jacoco/test/jacocoTestReport.xml'. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml

and if I search for the report xml I don't find it. Under my build folder I have:

generated
intermediates
jacoco
kotlin
outputs
reports
test-results
tmp

jacoco has only testDebugUnitTest.exec

reports path is like reports/tests/testDebugUnitTest it which are:

classes
css
index.html
js
packages

so no report xml. Someone knows how I can force jacoco to create xml report?

1

1 Answers

0
votes

JaCoCo plugin provides an option to enable the XML report generation:

plugins {
    id 'jacoco'
}

jacoco {
    toolVersion = '0.8.5'
}

jacocoTestReport {
    reports.xml.enabled = true
}