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

Coverage report includes classes that have been excluded from Jacoco analysis

    Details

    • Similar Issues:

      Description

      In my Maven config there are a number of classes that are excluded from Jacoco analysis. The report generated by Jacoco does not include these classes. The report generated by the Jenkins Jacoco plugin does includes these classes which gives a misleading picture and makes it difficult to set any coverage thresholds. I think this may be related to JENKINS-14975.

        Attachments

          Activity

          Hide
          arielma Ariel M added a comment -

          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?

          Show
          arielma Ariel M added a comment - 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?
          Hide
          pablogrisafi1975 Pablo Grisafi added a comment -

          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

           

           

          Show
          pablogrisafi1975 Pablo Grisafi added a comment - 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    
          Hide
          rajiv_jandial Rajiv Jandial added a comment -

          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.

          Show
          rajiv_jandial Rajiv Jandial added a comment - 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.
          Hide
          alan_czajkowski Alan Czajkowski added a comment -

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

          Show
          alan_czajkowski Alan Czajkowski added a comment - really looking forward to this fix! lots of anxiety around this bug
          Hide
          ataylor Alex Taylor added a comment -

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

          Show
          ataylor Alex Taylor added a comment - Thanks for the update Gabriel Stanek just wanted make sure I was understanding everyone's issue and how best I can fix it

            People

            • Assignee:
              ognjenb Ognjen Bubalo
              Reporter:
              daknin Darrell King
            • Votes:
              20 Vote for this issue
              Watchers:
              26 Start watching this issue

              Dates

              • Created:
                Updated: