[Solved] Jacoco is not running over service messages, no error messages

Hello Community

We tried to configure TC to import our multi-module maven project jacoco.exec results over service messages.
(https://www.jetbrains.com/help/teamcity/jacoco.html#JaCoCo-ImportingJaCoCocoveragedatatoTeamCity)

The message in the build log looks like following now:
[09:36:09]i: [Step 2/2] ##teamcity[jacocoReport dataPath='jacoco.exec' includes='com.ourcompany.*']

We also tried it with an absolute dataPath but nothing happens. We do not even get an error message or a log in the .teamcity directory.
In the overview of the build in TC, we have no coverage information and also not the coverage tab.

Can somebody please help us?

Our TC version:

TeamCity Professional 2019.1.1 (build 66192)

1
6 comments

Hi Marc,

 

we are aware of this issue: https://youtrack.jetbrains.com/issue/TW-61801

 

Please use the workarounds mentioned in there to get it to work for now. We plan to fix it for the next bugfix release but it's not done quite yet, so you might want to watch/vote for the issue to stay informed of any updates to it.

0

Hi Denis

Thank you for the response.

The workarounds in this ticket are:

  • Use Jacoco directly in the build configuration
  • Create a parameter that references the jacoco tool so that TeamCity is aware of its existence.

The first workaround is not working, we have there also no error log messages and also no jacoco log.

How does this parameter have to look like, do you have an example?

0

Hi Marc,

 

I think I might have rushed a bit my comment. While the situation is what it is (and I'll comment on your questions at the end), I wanted to note that if no error is coming out there might be something else going on. I'm not sure how you are pushing the service message into the output but it might not be being picked up if you are not receiving any error.

Also you mention that "the first workaround is not working". How have you set it up? If your build configuration is set to produce code coverage it should be picking it up (unless its misconfigured).

 

Adding the parameter should look something like %teamcity.tool.jacoco.DEFAULT% (or whichever version you are using). This will tell teamcity that you require the tool and should install it on the agents.

0

Hi Denis

We push the service message in maven with the echo plugin:

<build>
<plugins>
<plugin>
<groupId>com.soebes.maven.plugins</groupId>
<artifactId>echo-maven-plugin</artifactId>
<version>0.3.0</version>
<executions>
<execution>
<id>teamcity-jacoco-report</id>
<phase>verify</phase>
<goals>
<goal>echo</goal>
</goals>
<configuration>
<echos>
<echo>##teamcity[jacocoReport dataPath='jacoco.exec' includes='my.company.*']
</echo>
</echos>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

When we have a look at the other service message in the log it looks very similar:

Existing ones:
[15:03:51]i: [my.company.product:product-backend] ##teamcity[importData tc:tags='tc:internal' type='surefire' path='/opt/buildagent/work/65e76324407a4620/product-backend/target/failsafe-reports/TEST-*.xml' whenNoDataPublished='nothing' logAsInternal='true']

Our:
[15:03:51]i: [Step 2/2] ##teamcity[jacocoReport dataPath='jacoco.exec' includes='my.company.*']

When we use the build-in jacoco nothing happens, our configuration looks like this:

 

Then we have only these messages about jacoco in the log and also no jacoco log:

[15:34:13] : [Updating tools for build] Found 2 tools used by the build: jacoco.0.8.2, maven.3.6.1

[15:34:16] : [Step 2/2] Starting: /opt/java/openjdk/bin/java -Dagent.home.dir=/opt/buildagent "-Dagent.name=Docker Agent 00" -Dagent.ownPort=9090 -Dagent.work.dir=/opt/buildagent/work -Dbuild.number=12210 -Dbuild.vcs.number=2d4564ba35ec4c5c202eecaa20d15175bfffa7ef -Dbuild.vcs.number.1=2d4564ba35ec4c5c202eecaa20d15175bfffa7ef -Dbuild.vcs.number.Product5_HttpsSvnCompanyChGitCompanyProduct5gitRefsHeadsMaster=2d4564ba35ec4c5c202eecaa20d15175bfffa7ef -Dclassworlds.conf=/opt/buildagent/temp/buildTmp/teamcity.m2.conf -Dcom.jetbrains.maven.watcher.report.file=/opt/buildagent/temp/buildTmp/maven-build-info.xml -Djava.io.tmpdir=/opt/buildagent/temp/buildTmp -Dmaven.home=/opt/buildagent/tools/maven.3.6.1 -Dmaven.multiModuleProjectDirectory=/opt/buildagent/work/bb302ac4bbe93e0a -Dmaven.repo.local=/root/.m2/repository -Dteamcity.agent.cpuBenchmark=538 -Dteamcity.auth.password=******* -Dteamcity.auth.userId=TeamCityBuildId=35012 -Dteamcity.build.changedFiles.file=/opt/buildagent/temp/buildTmp/changedFiles8144945427703489851.txt -Dteamcity.build.checkoutDir=/opt/buildagent/work/bb302ac4bbe93e0a -Dteamcity.build.id=35012 -Dteamcity.build.properties.file=/opt/buildagent/temp/buildTmp/teamcity.build8786745198079788906.properties -Dteamcity.build.tempDir=/opt/buildagent/temp/buildTmp -Dteamcity.build.workingDir=/opt/buildagent/work/bb302ac4bbe93e0a "-Dteamcity.buildConfName=main branches" -Dteamcity.buildType.id=Product5_Master -Dteamcity.configuration.properties.file=/opt/buildagent/temp/buildTmp/teamcity.config6150565008355106030.properties "-Dteamcity.coverage.jacoco.classpath=+:**/classes/**/*.class
-:**/test-classes/**/*.class" -Dteamcity.coverage.jacoco.patterns=+:* -Dteamcity.coverage.jacoco.sources=. -Dteamcity.coverage.runner=JACOCO -Dteamcity.maven.watcher.home=/opt/buildagent/plugins/mavenPlugin/maven-watcher-jdk16 -Dteamcity.projectName=Product5 -Dteamcity.runner.properties.file=/opt/buildagent/temp/buildTmp/teamcity.runner2788072162820426664.properties -Dteamcity.tests.recentlyFailedTests.file=/opt/buildagent/temp/buildTmp/testsToRunFirst5674277162657761681.txt -Dteamcity.tool.jacoco=/opt/buildagent/tools/jacoco.0.8.2 "-Dteamcity.version=2019.1.1 (build 66192)" -classpath /opt/buildagent/tools/maven.3.6.1/boot/plexus-classworlds-2.6.0.jar: org.codehaus.plexus.classworlds.launcher.Launcher -f /opt/buildagent/work/bb302ac4bbe93e0a/pom.xml -B clean deploy -Pproduction-mode,ci-build,coverage -Dci.build.number=12210 -Dscm.branch=refs/heads/master -Dscm.revision=2d4564ba35ec4c5c202eecaa20d15175bfffa7ef

If we select IntelliJ IDEA as coverage runner also nothing happens.

What can we do?

0

The fact that it doesn't work at all with no engine is really strange. May I ask you to pick up the build logs and forward them to us using the "Submit a request" button above?

 

Coverage should work normally just fine, my first idea is that your paths to the classes might be excluding the classes for some reason, so I would try removing the filters and adding initially everything to check afterwards whether coverage is added or not, then once you get coverage, you can start filtering out classes.

0

Thanks to JetBrains support we were able to fix the problem.
The problem was that the ant plugins were disabled and the coverage plugin needs the ant plugin.

Thanks for the help

0

Please sign in to leave a comment.