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

Coverage report includes classes that have been excluded from Jacoco analysis

    XMLWordPrintable

Details

    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

          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?

          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?
          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

           

           

          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    
          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.

          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.

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

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

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

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

          People

            ognjenb Ognjen Bubalo
            daknin Darrell King
            Votes:
            23 Vote for this issue
            Watchers:
            29 Start watching this issue

            Dates

              Created:
              Updated: