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

Jacoco Plugin 3.0.3 fails build when no Jacoco exec files are available

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Duplicate
    • Component/s: jacoco-plugin
    • Labels:
      None
    • Environment:
    • Similar Issues:
    • Released As:
      3.0.4

      Description

      I have a Maven parent pom.xml which combines Java and non-Java builds.  Non-Java builds are built using maven plugins.  (The parent pom references child submodule in a profile for convenience, when I need to build everything, but these are not used during the release process).

      • The parent module has <packaging>pom</packaging>, and it contains no java, so no coverage -.exec file is generated. 
      • Some of the child modules are standard Java, with unit test etc. 
      • Some of the child modules are Javascript - the pom uses plugins to trigger the npm build script, assembles the webpacked artefacts to a ZIP file, and uploads it to our nexus.  No coverage -.exec file is generated.

      I have a single, generic build process for each of these types of module.

      Since Version 3.0.1, JaCoCo is failing my build when no exec files are found, with the following exception:  

      ERROR: Build step failed with exception java.lang.IllegalStateException: basedir /var/lib/jenkins/jobs/releases/jobs/Release/builds/19/jacoco/classes does not exist

       

      [JaCoCo plugin] Collecting JaCoCo coverage data...
      [JaCoCo plugin] **/**.exec;**/classes;**/src/main/java; locations are configured
      [JaCoCo plugin] Number of found exec files for pattern **/**.exec: 0
      [JaCoCo plugin] Saving matched execfiles: 
      [JaCoCo plugin] Saving matched class directories for class-pattern: **/classes: 
      [JaCoCo plugin] Saving matched source directories for source-pattern: **/src/main/java: 
      [JaCoCo plugin] Source Inclusions: null
      [JaCoCo plugin] Source Exclusions: null
      [JaCoCo plugin] Loading inclusions files..
      [JaCoCo plugin] inclusions: []
      [JaCoCo plugin] exclusions: []
      ERROR: Build step failed with exception
      java.lang.IllegalStateException: basedir /var/lib/jenkins/jobs/releases/jobs/Release/builds/19/jacoco/classes does not exist
       at org.codehaus.plexus.util.DirectoryScanner.scan(DirectoryScanner.java:281)
       at org.codehaus.plexus.util.FileUtils.getFileAndDirectoryNames(FileUtils.java:1940)
       at org.codehaus.plexus.util.FileUtils.getFileNames(FileUtils.java:1868)
       at org.codehaus.plexus.util.FileUtils.getFileNames(FileUtils.java:1850)
       at org.codehaus.plexus.util.FileUtils.getFiles(FileUtils.java:1825)
       at org.codehaus.plexus.util.FileUtils.getFiles(FileUtils.java:1808)
       at hudson.plugins.jacoco.ExecutionFileLoader.analyzeStructure(ExecutionFileLoader.java:124)
      Caused: java.lang.RuntimeException: While reading class directory: /var/lib/jenkins/jobs/releases/jobs/Release/builds/19/jacoco/classes
       at hudson.plugins.jacoco.ExecutionFileLoader.analyzeStructure(ExecutionFileLoader.java:131)
       at hudson.plugins.jacoco.ExecutionFileLoader.loadBundleCoverage(ExecutionFileLoader.java:137)
       at hudson.plugins.jacoco.JacocoReportDir.parse(JacocoReportDir.java:110)
       at hudson.plugins.jacoco.JacocoBuildAction.loadRatios(JacocoBuildAction.java:339)
       at hudson.plugins.jacoco.JacocoBuildAction.load(JacocoBuildAction.java:326)
       at hudson.plugins.jacoco.JacocoPublisher.perform(JacocoPublisher.java:657)
       at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:81)
       at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
       at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
       at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
       at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1073)
       at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
       at hudson.model.Run.execute(Run.java:1823)
       at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
       at hudson.model.ResourceController.execute(ResourceController.java:97)
       at hudson.model.Executor.run(Executor.java:429)
      

      Shouldn't the plugin simply do nothing when there are no exec files to process?

      If this is deemed to be a feature rather than a bug, then I request a configuration that controlls the behaviour, usable both from the UI "Record JaCoCo coverage report" form and also from the Groovy API, for use in pipeline steps.

       

        Attachments

          Issue Links

            Activity

            crowther Adam Crowther created issue -
            Hide
            crowther Adam Crowther added a comment - - edited

            Ticket JENKINS-49823 (linked) references the same problem in the comments at the bottom.  The last comment in that thread is: 

            centic added a comment - 2018-04-25 17:59

            You are welcome to send a PR for this, the code and the change is not complicated, the plugin is just short on active maintainers...

             

            Show
            crowther Adam Crowther added a comment - - edited Ticket  JENKINS-49823  (linked) references the same problem in the comments at the bottom.  The last comment in that thread is:  centic  added a comment - 2018-04-25 17:59 You are welcome to send a PR for this, the code and the change is not complicated, the plugin is just short on active maintainers...  
            crowther Adam Crowther made changes -
            Field Original Value New Value
            Link This issue is related to JENKINS-49823 [ JENKINS-49823 ]
            crowther Adam Crowther made changes -
            Summary Jacoco Plugin 3.0.3 fails build when no Jacoco exec files were available Jacoco Plugin 3.0.3 fails build when no Jacoco exec files are available
            Hide
            centic centic added a comment -

            Released via JENKINS-49823

            Show
            centic centic added a comment - Released via JENKINS-49823
            centic centic made changes -
            Status Open [ 1 ] Fixed but Unreleased [ 10203 ]
            Resolution Duplicate [ 3 ]
            Released As 3.0.4
            centic centic made changes -
            Status Fixed but Unreleased [ 10203 ] Resolved [ 5 ]

              People

              • Assignee:
                ognjenb Ognjen Bubalo
                Reporter:
                crowther Adam Crowther
              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: