Exclusions/Inclusions in jacoco.exec file.

75 views
Skip to first unread message

Sameer Kumar

unread,
Sep 2, 2024, 6:48:57 AM9/2/24
to JaCoCo and EclEmma Users
Hi all

Is there any way I can merge several jacoco.exec files into a aggregated .exec file with some inclusions and exclusions?
Or is there a way to exclude/include classes before generating the child module  jacoco.exec file.

P.S. - I am working on a multi module project, and I need to generate an aggregated report (unit test) with some inclusions and exclusions. Also I need to fail the build if the coverage is below a certain percentage (this is why I need to exclude non-required classes from the .exec file so that to run jacoco-check correctly).

Thank You

Marc Hoffmann

unread,
Sep 2, 2024, 1:16:14 PM9/2/24
to JaCoCo and EclEmma Users
Hi Sameer,

while technically this would be possible our tools (Maven, Ant, CLI) do not offer such an option.

Just to double check: What exactly do you want to achieve with the exec file filtering? If you filter execution data the respective classes will be shown as uncovered in the report.

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/80f7d7c6-2fe7-4e0c-a89d-aaf0a182901bn%40googlegroups.com.

Sameer Kumar

unread,
Sep 2, 2024, 2:16:38 PM9/2/24
to JaCoCo and EclEmma Users
By exec filtering I mean that those classes should not be included in the report at all.
I am currently using jacoco-report-aggregate goal to create aggregated report, I am also doing inclusions and exclusions in this goal itself.

however I also want to add a check on the aggregated report (on line coverage), but when I am putting check, it is checking on the entire classes(exclusions are not being considered while check goal). This results in drop in the line coverage percentage.

Summing up, report-aggregate is creating a report with proper exclusions, but check is checking on the entire project ignoring the exclusions hence resulting in wrong checking (as per my requirement).

Please help me out on this issue.

Marc Hoffmann

unread,
Sep 2, 2024, 3:45:09 PM9/2/24
to jac...@googlegroups.com
What should be shown in the report needs to be configured for the reports.

JaCoCo does not have a Maven check goal for aggregated reports. This is only possible in Ant. If you have complex requirements I recommend embedding a Ant task in your Maven build. With the Ant report task you can create arbitrary structures and filters and also embed checks directly in the report.

Sameer Kumar

unread,
Sep 3, 2024, 2:52:14 AM9/3/24
to JaCoCo and EclEmma Users
Thanks for the info.
Just a small question, is there a way to put exclusions in the check goal? at any level(entire project or even at module level)

Marc Hoffmann

unread,
Sep 3, 2024, 3:21:41 PM9/3/24
to JaCoCo and EclEmma Users

Sameer Kumar

unread,
Sep 4, 2024, 2:09:35 AM9/4/24
to JaCoCo and EclEmma Users
Thanks you.
Reply all
Reply to author
Forward
0 new messages