问题
I have a Gradle task to upload jacoco coverage to TeamCity (following TeamCity documentation here: Importing JaCoCo coverage data to TeamCity):
task uploadJacocoTestReport {
doLast {
println "##teamcity[jacocoReport dataPath='build/jacoco/jacocoTest.exec' " +
"includes='com.mypackage.*' " +
"classpath='build/classes/main']"
}
}
If I use Gradle 3.5
, TeamCity build is able to display CodeCoverage report in the build log. But when I switch to Gradle 4.5
, the Code Coverage section no longer appears in the build log. How do I upload jacoco report with Gradle 4.5?
TeamCity version 10.0.5 (build 42677)
jacoco version 0.8.0
回答1:
I had same problem with teamcity and it printed me next message:
[Generating JaCoCo coverage...] JaCoCo report generation failed. Exit code: 1
try using:
println "##teamcity[jacocoReport dataPath='$project.buildDir/jacoco/jacocoTest.exec' ...]"
instead of:
println "##teamcity[jacocoReport dataPath='build/jacoco/jacocoTest.exec' ...]"
回答2:
I had to import Jacoco reports in TeamCity in a couple of projects based on Gradle v4 and 5.
One thing that helped me was to look at the Jacoco import log, which you can find in the build's hidden artifacts:
- Go to Build page > Artifacts
- Find the sentence "There are also hidden artifacts. Show" and click "Show"
- In the list of artifacts, expand ".teamcity/coverage_jacoco/"
- Open jacoco.log
Hope it helps.
来源:https://stackoverflow.com/questions/49146449/unable-to-upload-jacoco-report-to-teamcity-with-gradle-4-5