Method coverage exclusion not working in eclipse and Jenkins using jacoco plugin version 0.8.2+

80 views
Skip to first unread message

Ankit Jain

unread,
Jan 3, 2022, 7:13:03 PM1/3/22
to Jenkins JaCoCo plugin mailing list
HI Team,

We want to exclude the jacoco coverage for certain methods from some of the classes. For that we using the custom annotation based feature introduced in jacoco plugin from 0.8.2 version onwards.

For us we are using this plugin both in eclipse and through jenkins but unfortunately it is not excluding the annotated methods from coverage. We are getting jacoco coverage including these methods too.
 
Eclipse Version: 2021-09 (4.21.0), Build id: 20210910-1417
Jenkins jacoco plugin version: 3.3.1. 
Maven version: 3.6.1
Running the below cmd from eclipse to generate jacoco code coverage:
clean org.jacoco:jacoco-maven-plugin:prepare-agent install jacoco:report
From jenkins:
clean -B -U -T 2 org.jacoco:jacoco-maven-plugin:prepare-agent pmd:pmd pmd:cpd findbugs:findbugs -Dmaven.test.failure.ignore=true package

One thing to mention here is that in my pom i dont added jacoco-maven-plugin explicitly and just running that jacoco plugin directly from arguments like above.

Custom annotation created like below:

@Retention(RUNTIME)
@Target(METHOD)
public @interface Generated {}

I tried with other name like ExcludeMethodFromJacocoGeneratedReport but no luck.

Usage of annotation example in my code:
@Generated
public void method() {}

Another example:
@ExcludeMethodFromJacocoGeneratedReport
public void method() {}

Let me know what is missing here. 

Regards-
Ankit

Dominik Stadler

unread,
Jan 6, 2022, 5:51:19 AM1/6/22
to jenkins-jacoco-pl...@googlegroups.com
Hi,

this sounds like a question for the JaCoCo code coverage functionality itself. This is not handled here, as this list mostly focusses on the Jenkins plugin for including JaCoCo results in build results. You will get better answers if you contact the JaCoCo developers directly or ask via stackoverflow.

Thanks... Dominik.

--
Azért kapta ezt az üzenetet, mert feliratkozott a Google Csoportok „Jenkins JaCoCo plugin mailing list” csoportjára.
Az erről a csoportról és az ahhoz kapcsolódó e-mailekről való leiratkozáshoz küldjön egy e-amailt a(z) jenkins-jacoco-plugin-m...@googlegroups.com címre.
Ha szeretné megtekinteni ezt a beszélgetést az interneten, látogasson el ide: https://groups.google.com/d/msgid/jenkins-jacoco-plugin-mailing-list/720c0254-bc93-4253-a26f-f6bf63ca2513n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages