如何在Bamboo上的Gradle中生成JaCoCo xml报告

问题描述

我使用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
}

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...