Unable to upload jacoco report to TeamCity with Gradle 4.5

六眼飞鱼酱① 提交于 2020-01-06 03:22:10

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!