这是我的sonar.properties档案
sonar.host.url=https://sonar.cloud.health.ge.com/
sonar.projectKey=ils
sonar.projectName=ILS
sonar.projectVersion=1.0.0
sonar.sources=library/core
sonar.java.binaries=library/core/target/classes
sonar.exclusions=library/core/target/**/*, library/core/src/test/**/*
sonar.tests=library/core/src/test/
sonar.java.test.libraries=library/core/target/test-classes/
> sonar.junit.reportsPath=library/core/target/surefire-reports/CalculatorTest.xml
// test cases are generated fine but sonarqube is not taking the junit reports in the pipeline
sonar.coverage.jacoco.xmlReportPaths=library/core/target/site/jacoco/jacoco.xml
我已经手动推送了测试报告,下面是Jenkins文件中的单元测试命令
unitTestCommand = 'cd library/core && mvn test && mvn surefire-report:report'
unitTestReportDir = 'library/core/target/site'
arch = 'hc-eu-west-aws-artifactory.cloud.health.ge.com/docker-eis-all/build-tools-eis-repo:1.0.0'
2条答案
按热度按时间rpppsulh1#
您需要使用jacoco maven插件(https://www.jacoco.org/)生成覆盖率报告。
dldeef672#
**问题已解决:**路径中存在问题,sonar.junit.reportsPath应指向目录而不是特定文件: