Jacoco Maven Plugin - Different results for Merge vs Append

267 views
Skip to first unread message

Marvin

unread,
Jul 31, 2018, 2:37:37 AM7/31/18
to JaCoCo and EclEmma Users
Hello together,

we have a multi module Maven project and collect its coverage with the jacoco-maven-plugin in version 0.8.1. 

We configured jacoco to append the reports of all modules to a single on in the project root target dir:

/parent
    /module-1
        [...]
    /module-2
        [...]
    /target
        jacoco-append.exec

This works fine since years and we receive a coverage of ~70%.

We now had the idea to implement some changes in our build pipeline. I guess the details are not important, but the result would be that we end  up with a jacoco.exec file per module:

/parent
    /module-1
        /target
            jacoco.exec
        [...]
    /module-2
        /target
            jacoco.exec
        [...]

Based on that, we used the "merge" goal of the jacoco-maven-plugin to end up with one single exec file again. This again, seems to work fine too, but sadly, our coverage is now down to 50% without any "exclusion" / "inclusion" changes on our side.

Has anyone an idea or a hint what could cause this? Do "append" and "merge" work different and is this even an expected bahavior? 

Thank you very much and best regards.

Marc Hoffmann

unread,
Jul 31, 2018, 5:27:40 AM7/31/18
to jac...@googlegroups.com

Hi,

append and merge should give the same results. When reading exec files for report generation all data included is merged. I.e. when exec data for the same class occures multiple time (due to append) it gets merged when reading the exec file.

Some hints to identify the problem in your case:

  • Check your build log at what point in time the merge happens and when is the report generated. Maybe not everything is merged when the report is generated?
  • Drill down the old and new Reports for specific areas where there is a major difference. Maybe this gives you a clue?
  • The JaCoCo HTML report has a "Sessions" link on the top right corner. Here the content of the exec files is listed.
  • Alternatively you can dump the content of the exec files with our command line tools: See 'execinfo' command (https://www.jacoco.org/jacoco/trunk/doc/cli.html)

If you think the problem is with JaCoCo please create a standalone reproducer (preferrable GitHub repo).

Regards,
-marc

--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/b95d6404-8348-4020-8764-c317c43c736f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Marvin

unread,
Aug 1, 2018, 4:32:22 AM8/1/18
to JaCoCo and EclEmma Users
Hello Marc and a big thank you for your fast reply,

we will go through your suggestion and keep the thread updated.

when exec data for the same class occurs multiple time (due to append) it gets merged when reading the exec file.

One thing I have not shared: We are using SQ to import the dump - Do you maybe know about some problems reported in that direction? :)

Best regards,

Marvin

Marc Hoffmann

unread,
Aug 1, 2018, 5:39:34 AM8/1/18
to jac...@googlegroups.com
Hi Marvin,

regarding SonarQube please get in touch with their support channels. We’re not working on this integration.

Regards,
-marc


Evgeny Mandrikov

unread,
Aug 1, 2018, 7:56:32 AM8/1/18
to JaCoCo and EclEmma Users
Hi Marvin,

In addition to what was said by Marc: Report is a result of analysis of exec-files and classes. Tomorrow SonarQube might start consuming our XML report, but as of today it also performs analysis of exec-files and classes to generate its report, so watch out in which order and which exec-files and which classes are actually analyzed by SonarQube. BTW to differentiate between misconfiguration of merges/appends and misconfiguration of SonarQube, you can compare native JaCoCo report produced by our command line interface ( https://www.jacoco.org/jacoco/trunk/doc/cli.html ) with report in SonarQube.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+unsubscribe@googlegroups.com.

ggr...@gmail.com

unread,
Aug 28, 2018, 8:36:58 AM8/28/18
to JaCoCo and EclEmma Users

David Karlsen

unread,
Oct 27, 2018, 6:53:17 PM10/27/18
to JaCoCo and EclEmma Users
Did you ever solve this?
I have a similar problem where the coverage is not right, I have (among other modules) a service module and a dao modules. There are no tests in the dao module, but tests in the service module will excercise the daos - still the coverage is 0% for any dao classes.
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages