[JIRA] [jacoco-plugin] (JENKINS-15570) Coverage report includes classes that have been excluded from Jacoco analysis

3 views
Skip to first unread message

christian.schulz@ewetel.net (JIRA)

unread,
Sep 9, 2015, 3:43:01 AM9/9/15
to jenkinsc...@googlegroups.com
C. S. updated an issue
 
Jenkins / Bug JENKINS-15570
Coverage report includes classes that have been excluded from Jacoco analysis
Change By: C. S.
Priority: Minor Major
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265)
Atlassian logo

christian.schulz@ewetel.net (JIRA)

unread,
Sep 9, 2015, 3:45:01 AM9/9/15
to jenkinsc...@googlegroups.com
C. S. commented on Bug JENKINS-15570
 
Re: Coverage report includes classes that have been excluded from Jacoco analysis

We ran into the same issue. It is important for us to get it working, because we have a lot of generated classes, which should be excluded and it would be a mess to set up each Jenkins job according the new classes.

So we decided to exclude the classes from the report via pom. But it seems that the jacoco plugin does its own match from classes to exec file.

raj.bhaskar@glasgow.ac.uk (JIRA)

unread,
Jan 18, 2016, 8:15:06 AM1/18/16
to jenkinsc...@googlegroups.com

I think I'm having the same issue. I package the Oracle JDBC driver as a local jar in my application (as it's not on maven) but it looks like although I'm excluding it in my pom, the plugin is still including it when doing its analysis.

zteve@skipjaq.com (JIRA)

unread,
Aug 25, 2016, 9:59:01 AM8/25/16
to jenkinsc...@googlegroups.com

This is an issue for us also. In a maven build with the jacoco plugin we exclude all the classes in a package; and jacoco reports in the console log that these have been excluded.

In the jacoco check phase, no further inclusions/exclusions are supplied but thresholds are provided.

The coverage report given by Jenkins seems to include those classes, the coverage percentages (package, line and so on) remaining the same as without exclusion. The threshold checks (in particular the line thresholds) still apply and make the build fail.

The classes we exclude are generated into generated-sources by a third party (immutables.org) which we do not wish to test.

This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

antoine.tran@thales-services.fr (JIRA)

unread,
Mar 27, 2017, 10:56:06 AM3/27/17
to jenkinsc...@googlegroups.com

We have this issue too. Right now, we need to duplicate exclusion information from pom.xml into this Jenkins Jacoco plugin. This issue is not solved yet.

This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

jgangemi@gmail.com (JIRA)

unread,
Mar 9, 2018, 10:47:02 AM3/9/18
to jenkinsc...@googlegroups.com

is there any futher movement on this issue? configuring exclusions in maven and jenkins is not a viable work around.

ataylor@cloudbees.com (JIRA)

unread,
Aug 8, 2018, 2:01:06 PM8/8/18
to jenkinsc...@googlegroups.com

I was looking into this issue and it appears that the Jacoco plugin fixed this issue for ENV variables with https://github.com/jenkinsci/jacoco-plugin/pull/74 but it does not actually parse the pom.xml for the `excludes`(or `includes` for that matter) configuration. Does that sound like the actual issue here rather than the Excludes not working at all?

 

Did I miss anything here? I was going to work on getting this fixed with a PR hopefully within the next week

This message was sent by Atlassian JIRA (v7.10.1#710002-sha1:6efc396)

jgangemi@gmail.com (JIRA)

unread,
Aug 8, 2018, 2:23:03 PM8/8/18
to jenkinsc...@googlegroups.com

i'm confused as to why this information just isn't part of the generated results file in the first place as a block that indicates what to exclude. perhaps even better would just be excluding the classes from the result file outright. disclaimer: i have not looked into how the maven plugin works when i choose to generate a report, but it does do the proper exclusions.

if the plugin needs to parse the pom to figure this out, then that is the fix but that doesn't really seem like the correct solution here b/c what if i'm a nodejs project that is able to generate coverage reports in jacoco format? there's not going to be any pom to parse for exclusions in that case.

gabe.stanek@gmail.com (JIRA)

unread,
Aug 8, 2018, 3:09:03 PM8/8/18
to jenkinsc...@googlegroups.com

Alex Taylor , what you've described, regarding the exclude block in the maven plugin not taking affect in Jenkins, is the issue I've seen and am interested in a fix for, and seems to align with the initial description (which is specific to maven based projects).

ataylor@cloudbees.com (JIRA)

unread,
Aug 8, 2018, 4:38:01 PM8/8/18
to jenkinsc...@googlegroups.com

Thanks for the update Gabriel Stanek just wanted make sure I was understanding everyone's issue and how best I can fix it

alan@czajkowski.ca (JIRA)

unread,
Dec 7, 2018, 2:45:03 PM12/7/18
to jenkinsc...@googlegroups.com

really looking forward to this fix! lots of anxiety around this bug

This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

rajiv.jandial@pearson.com (JIRA)

unread,
Jan 9, 2019, 4:18:02 PM1/9/19
to jenkinsc...@googlegroups.com

I am still seeing this as an open issue. Even I exclude the package from the pom.xml as well as from the Jenkins "exclusions" fields, those packages are still being included in the JaCoCo report.

pablogrisafi1975@gmail.com (JIRA)

unread,
Sep 17, 2019, 5:04:03 PM9/17/19
to jenkinsc...@googlegroups.com

my workaround: in the pom.xml I save all patterns  as properties:

<coverage-exclusion-01>*/com/company/product//config//.</coverage-exclusion-01><coverage-exclusion-02>/com/company/cfa//CallDTO.</coverage-exclusion-02><coverage-exclusion-03>*/com/company/cfa/*/DAO.</coverage-exclusion-03>

And I use them to configure the maven jacoco plugin

<configuration> <excludes> <exclude>${coverage-exclusion-01}</exclude> <exclude>${coverage-exclusion-02}</exclude>

etc...

 

And then, in the pipeline file y read again the properties

 

script{      props = readMavenPom().getProperties()     exclusionPattern = props.entrySet().findAll\{entry -> entry.key.startsWith('coverage-exclusion-')}.collect{it.value}.join(',')
    echo "exclusionPattern = ${exclusionPattern}"
}
jacoco( execPattern: '**/target/jacoco.exec', exclusionPattern: exclusionPattern)

 

It works, but is ugly

 

 

This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

arielman22@gmail.com (JIRA)

unread,
Oct 31, 2019, 11:31:03 AM10/31/19
to jenkinsc...@googlegroups.com
Ariel M commented on Bug JENKINS-15570

We are also facing the same issue. it's weird coz' it's working for one MS, but not for the other. is there any update for it?

Reply all
Reply to author
Forward
0 new messages