问题描述
我使用gradlew
命令在Bamboo版本上运行SonarQube:
./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
无论我使用哪个TEST_REPORTS_PATH
,我总能得到
使用sonar.coverage.jacoco.xmlReportPaths ='build / reports / jacoco / test / jacocoTestReport.xml'找不到覆盖率报告。使用默认位置:target / site / jacoco / jacoco.xml,target / site / jacoco-it / jacoco.xml,build / reports / jacoco / test / jacocoTestReport.xml
,如果我搜索报告xml
,则找不到它。我的build
文件夹下有:
generated
intermediates
jacoco
kotlin
outputs
reports
test-results
tmp
jacoco
只有testDebugUnitTest.exec
reports
路径类似于reports/tests/testDebugUnitTest
,它是:
classes
css
index.html
js
packages
因此没有报告xml
。有人知道我可以如何迫使jacoco创建xml
报告吗?
解决方法
JaCoCo plugin提供了启用XML报告生成的选项:
plugins {
id 'jacoco'
}
jacoco {
toolVersion = '0.8.5'
}
jacocoTestReport {
reports.xml.enabled = true
}