Is it possible to capture jacoco.exec in the build?

We're just starting to use SonarQube as an analysis and dashboard platform for our projects.  Sonar is capable of pulling in the jacoco.exec file and tracking coverage info, but I don't see any way to access the file from within the build itself (as opposed to post-build when it's an artifact).  Looking at the build log, the agent generates it as AGENT_HOME/temp/buildTmp/JACOCOLongUnpredictableNumbercoverage/jacoco.exec.  Is there some way to grab that jacoco.exec file and use /position it from within a build step?

2 comments
Comment actions Permalink

Hi Mark,

JaCoCo coverage data import was implemented in TeamCity 9.0. For more details please see the documentation.

0
Comment actions Permalink

A very late response but I came across this post where trying to find the answer to the same problem.

As we only have TeamCity 8.x at the moment the approach previously suggested was not going to help.

After a bit of digging around I found the TeamCity variable teamcity.coverage.tempdir.path points to the folder containing the jacoco.exe file. I could then reference this in the ant build file as ${teamcity.coverage.tempdir.path}. In my case all I needed to do was copy the file to a standard location that was later picked up by Sonar.

0

Please sign in to leave a comment.