Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-59813

JacocoPublisher (part of pipeline-maven) does not deal with excludes properly

    Details

    • Similar Issues:

      Description

      The jacoco report published by pipeline indicates classes that should have been excluded.

       

      Our build, a multi-module maven build executes jacoco on multiple modules.  In the POM, we indicate <exclude> on a number of classes (generated java).  When built by maven (command-line), the jacoco report is properly created - excluded files are properly excluded.  When we wrapper this build into a jenkinsfile and invoke it via a withMaven(..), the JacocoPublisher kicks in.  The jacoco report on the Jenkins job appears to include the excluded files.  It looks to me like JacocoPublisher is reinvoking Jacoco-Plugin with default parameters. The Jacoco-Plugin output shows a blank line for 'exclude', which explains why the report has things it should not.

      I suspect the easiest solution is to offer a parameter on JacocoPubisher that would pass-through to the Jacoco-Plugin.  This would allow people to write Jenkinsfiles, enter the 'excludes' they desire, and Jacoco-Plugin would then run properly.

        Attachments

          Activity

          Hide
          jbennett20912 Jeffrey Bennett added a comment -

          Found a work-around of sorts.   Completely disable the JacocoPublisher and use the external 'jacoco' step instead.  Since the latter accepts exclude, it can be properly configured.  If you don't disable the JacocoPublisher, you wind up with two similar looking reports in Jenkins.

          Show
          jbennett20912 Jeffrey Bennett added a comment - Found a work-around of sorts.   Completely disable the JacocoPublisher and use the external 'jacoco' step instead.  Since the latter accepts exclude, it can be properly configured.  If you don't disable the JacocoPublisher, you wind up with two similar looking reports in Jenkins.
          Show
          cleclerc Cyrille Le Clerc added a comment - Work In Progress: JacocoPublisher settings only support a `disabled` flag. See  https://github.com/jenkinsci/pipeline-maven-plugin/blob/pipeline-maven-3.8.2/jenkins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/publishers/JacocoReportPublisher.java#L254  

            People

            • Assignee:
              alobato Alvaro Lobato
              Reporter:
              jbennett20912 Jeffrey Bennett
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: