TeamCity 2020.1 offers three bundled versions of JaCoCo:
Enabling JaCoco coverage
TeamCity supports the Java agent coverage mode allowing you to collect coverage without modifying build scripts or binaries. No additional build steps needed - just choose JaCoCo coverage in a build step which runs tests:
In the Code Coverage section, select JaCoCo as a coverage tool in the Choose coverage runner drop-down menu.
Set up the coverage options - refer to the description of the available options below.
Classfile directories or jars
Newline-delimited set of path patterns in the form of +|-:[path] relative to the checkout directory to scan for classfiles to be analyzed. Libraries and test classfiles don't have to be listed unless their coverage is wanted.
Classes to instrument
Newline-delimited set of classname patterns in the form of +|-:[path]. Allows filtering out unwanted classes listed in "Classfile directories or jars" field. Useful in case test classes are compiled.
The code coverage results can be viewed on the Overview tab of the Build Results page; detailed report is displayed on the dedicated Code Coverage tab.
Importing JaCoCo coverage data to TeamCity
TeamCity can parse JaCoCo coverage data and generate a report using a service message of the following format:
##teamcity[jacocoReport dataPath='<path to jacoco.exec file>']
Space-delimited set of paths relative to the checkout directory to read the jacoco data file