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

Groovy Class Files Not Copied Over To View Code Coverage

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • jacoco-plugin
    • None
    • 3.0.5

      As part of JENKINS-38604 a change was made to only copy over .java files. However this means any files with the .groovy extension can't be viewed. .groovy should be added to the list of make this a configurable option.

          [JENKINS-56918] Groovy Class Files Not Copied Over To View Code Coverage

          Pavol Briatka added a comment - - edited

          Hello, I think I had a similar issue. I could not see Kotlin files in Jenkins when I checked Jacoco coverage (error message: "Error while reading the sourcefile!") but I managed to solve it by putting the following line to my Jenkinsfile jacoco step configuration:

          sourceInclusionPattern: '**/*.*'

          Now both Java and Kotlin files are showed in reports. I checked the source code for JacocoPublisher where I found that the default value for String sourceInclusionPattern is indeed set to copy only java files but you can rewrite it either in post-build actions tab in Jenkins or in your Jenkinsfile (depending on your implementation).
          The above mentioned implementation will include all files from your source code (defined as sourcePattern)

          Pavol Briatka added a comment - - edited Hello, I think I had a similar issue. I could not see Kotlin files in Jenkins when I checked Jacoco coverage (error message: "Error while reading the sourcefile!" ) but I managed to solve it by putting the following line to my Jenkinsfile jacoco step configuration: sourceInclusionPattern: '**/*.*' Now both Java and Kotlin files are showed in reports. I checked the source code for JacocoPublisher where I found that the default value for String sourceInclusionPattern is indeed set to copy only java files but you can rewrite it either in post-build actions tab in Jenkins or in your Jenkinsfile (depending on your implementation). The above mentioned implementation will include all files from your source code (defined as sourcePattern)

          centic added a comment - - edited

          I adjusted the default to "*/.java,*/.groovy,*/.kt,*/.kts" for the next release, will probably be called 3.0.5

          centic added a comment - - edited I adjusted the default to "* / .java,* / .groovy,* / .kt,* / .kts" for the next release, will probably be called 3.0.5

            centic centic
            john_slater John Slater
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: