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.
- is related to
-
JENKINS-49823 Jacoco Plugin 3.0.1 fails build as basedir now incorrect
- Resolved