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

Plug-in configuration is inflexible and counter-intuitive

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • jacoco-plugin
    • None

      1. Sources must be in sub-directories of the Jenkins job's workspace. For jobs using a custom workspace this will typically not be the case.
      2. Classes must be present as loose class files in sub-directories of the Jenkins job's workspace. It should be possible to specify a generalized class path involving arbitrary directories and JAR files.
      3. Inclusions and exclusions must be specified as a class file filter pattern. This is counter-intuitive and also contrary to the wildcard package/class matching pattern supported by the JaCoCo agent.

          [JENKINS-19621] Plug-in configuration is inflexible and counter-intuitive

          David Miller added a comment -

          To add to the counter-intuitive piece: We don't have access to source in our automation, so I left the "Path to source directories" blank. Much to my chagrin, the plug-in interpreted that as the workspace directory, so each build saved off the entire workspace directory, 3GB in our case. I assumed a blank field meant you didn't have sources.

          David Miller added a comment - To add to the counter-intuitive piece: We don't have access to source in our automation, so I left the "Path to source directories" blank. Much to my chagrin, the plug-in interpreted that as the workspace directory, so each build saved off the entire workspace directory, 3GB in our case. I assumed a blank field meant you didn't have sources.

          Ognjen Bubalo added a comment -

          We have a direction of reimplementing usage of XMLs generated by JaCoCo. This would fix this I think.

          Ognjen Bubalo added a comment - We have a direction of reimplementing usage of XMLs generated by JaCoCo. This would fix this I think.

          David Miller added a comment -

          Will the reimplementation address the confusion about inclusions and exclusions? I am having a hard time trying to figure out how to do exclusions; the doc is a little thin on that account. I am using off-line instrumentation (which appears to work OK), and on one of my runs I get the error below during the plug-in's report generation. I've tried different ways to specify the offending class as an exclusion, but no luck so far. Also, I'm not sure whether the class needs to be excluded during instrumentation or during report generation. I've been trying both, but still no luck.

          [JaCoCo plugin] exclusions: [org/apache/commons/codec/binary/Base64*]
          ERROR: Publisher hudson.plugins.jacoco.JacocoPublisher aborted due to exception
          java.lang.IllegalStateException: Can't add different class with same name: org/apache/commons/codec/binary/Base64
          at java.lang.Throwable.<init>(Throwable.java:67)
          at org.jacoco.core.analysis.CoverageBuilder.visitCoverage(CoverageBuilder.java:85)
          at org.jacoco.core.analysis.Analyzer$1.visitEnd(Analyzer.java:79)
          at org.objectweb.asm.ClassVisitor.visitEnd(Unknown Source)
          at org.jacoco.core.internal.flow.ClassProbesAdapter.visitEnd(ClassProbesAdapter.java:135)
          at org.objectweb.asm.ClassReader.accept(Unknown Source)
          at org.objectweb.asm.ClassReader.accept(Unknown Source)
          at org.jacoco.core.analysis.Analyzer.analyzeClass(Analyzer.java:94)
          at org.jacoco.core.analysis.Analyzer.analyzeClass(Analyzer.java:115)
          at org.jacoco.core.analysis.Analyzer.analyzeAll(Analyzer.java:153)
          at org.jacoco.core.analysis.Analyzer.analyzeArchive(Analyzer.java:135)
          at org.jacoco.core.analysis.Analyzer.analyzeAll(Analyzer.java:158)
          at org.jacoco.core.analysis.Analyzer.analyzeArchive(Analyzer.java)
          at org.jacoco.core.analysis.Analyzer.analyzeAll(Analyzer.java:158)
          at org.jacoco.core.analysis.Analyzer.analyzeArchive(Analyzer.java:135)
          at org.jacoco.core.analysis.Analyzer.analyzeAll(Analyzer.java:158)
          at org.jacoco.core.analysis.Analyzer.analyzeArchive(Analyzer.java)
          at org.jacoco.core.analysis.Analyzer.analyzeAll(Analyzer.java:158)
          at org.jacoco.core.analysis.Analyzer.analyzeAll(Analyzer.java:183)
          at hudson.plugins.jacoco.ExecutionFileLoader.analyzeStructure(ExecutionFileLoader.java:139)
          at hudson.plugins.jacoco.ExecutionFileLoader.loadBundleCoverage(ExecutionFileLoader.java:146)
          at hudson.plugins.jacoco.JacocoBuildAction.getJacocoReports(JacocoBuildAction.java:249)
          at hudson.plugins.jacoco.JacocoBuildAction.loadRatios(JacocoBuildAction.java:333)
          at hudson.plugins.jacoco.JacocoBuildAction.load(JacocoBuildAction.java:314)
          at hudson.plugins.jacoco.JacocoPublisher.perform(JacocoPublisher.java:375)
          at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
          at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:804)
          at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:776)
          at hudson.model.Build$BuildExecution.post2(Build.java:183)
          at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:726)
          at hudson.model.Run.execute(Run.java:1618)
          at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
          at hudson.model.ResourceController.execute(ResourceController.java:88)
          at hudson.model.Executor.run(Executor.java:247)

          David Miller added a comment - Will the reimplementation address the confusion about inclusions and exclusions? I am having a hard time trying to figure out how to do exclusions; the doc is a little thin on that account. I am using off-line instrumentation (which appears to work OK), and on one of my runs I get the error below during the plug-in's report generation. I've tried different ways to specify the offending class as an exclusion, but no luck so far. Also, I'm not sure whether the class needs to be excluded during instrumentation or during report generation. I've been trying both, but still no luck. [JaCoCo plugin] exclusions: [org/apache/commons/codec/binary/Base64*] ERROR: Publisher hudson.plugins.jacoco.JacocoPublisher aborted due to exception java.lang.IllegalStateException: Can't add different class with same name: org/apache/commons/codec/binary/Base64 at java.lang.Throwable.<init>(Throwable.java:67) at org.jacoco.core.analysis.CoverageBuilder.visitCoverage(CoverageBuilder.java:85) at org.jacoco.core.analysis.Analyzer$1.visitEnd(Analyzer.java:79) at org.objectweb.asm.ClassVisitor.visitEnd(Unknown Source) at org.jacoco.core.internal.flow.ClassProbesAdapter.visitEnd(ClassProbesAdapter.java:135) at org.objectweb.asm.ClassReader.accept(Unknown Source) at org.objectweb.asm.ClassReader.accept(Unknown Source) at org.jacoco.core.analysis.Analyzer.analyzeClass(Analyzer.java:94) at org.jacoco.core.analysis.Analyzer.analyzeClass(Analyzer.java:115) at org.jacoco.core.analysis.Analyzer.analyzeAll(Analyzer.java:153) at org.jacoco.core.analysis.Analyzer.analyzeArchive(Analyzer.java:135) at org.jacoco.core.analysis.Analyzer.analyzeAll(Analyzer.java:158) at org.jacoco.core.analysis.Analyzer.analyzeArchive(Analyzer.java) at org.jacoco.core.analysis.Analyzer.analyzeAll(Analyzer.java:158) at org.jacoco.core.analysis.Analyzer.analyzeArchive(Analyzer.java:135) at org.jacoco.core.analysis.Analyzer.analyzeAll(Analyzer.java:158) at org.jacoco.core.analysis.Analyzer.analyzeArchive(Analyzer.java) at org.jacoco.core.analysis.Analyzer.analyzeAll(Analyzer.java:158) at org.jacoco.core.analysis.Analyzer.analyzeAll(Analyzer.java:183) at hudson.plugins.jacoco.ExecutionFileLoader.analyzeStructure(ExecutionFileLoader.java:139) at hudson.plugins.jacoco.ExecutionFileLoader.loadBundleCoverage(ExecutionFileLoader.java:146) at hudson.plugins.jacoco.JacocoBuildAction.getJacocoReports(JacocoBuildAction.java:249) at hudson.plugins.jacoco.JacocoBuildAction.loadRatios(JacocoBuildAction.java:333) at hudson.plugins.jacoco.JacocoBuildAction.load(JacocoBuildAction.java:314) at hudson.plugins.jacoco.JacocoPublisher.perform(JacocoPublisher.java:375) at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:804) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:776) at hudson.model.Build$BuildExecution.post2(Build.java:183) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:726) at hudson.model.Run.execute(Run.java:1618) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:247)

          David Miller added a comment -

          I have one more bit of information about the exclusions. I created an Ant build file to manually generate the report and reproduced the same error as in my previous post. I turned on the verbose switch and got:

          BUILD FAILED
          Caused by: java.io.IOException: Error while analyzing class news_cd.jar@news/news/news.jar@installableApps/news.ear@commons-codec-1.4.jar@org/apache/commons/codec/binary/Base64.class.
          Caused by: java.lang.IllegalStateException: Can't add different class with same name: org/apache/commons/codec/binary/Base64

          As you can see, I'm using jar files and here is a case where there are nested jar and ear files. So far, the only way I was able to avoid the error was to exclude the entire news_cd.jar in the report generation build file:

          <structure name="Example Project">
          <group name="mygroup">
          <classfiles>
          <fileset dir="/local/ci/news/jars_original" excludes="news_cd.jar"/>
          </classfiles>
          </group>
          </structure>

          Is there a way to specify the the Base64 class or the entire commons-codec-1.4.jar in an exclusion when they are buried in a nested jar/ear file hierarchy?

          David Miller added a comment - I have one more bit of information about the exclusions. I created an Ant build file to manually generate the report and reproduced the same error as in my previous post. I turned on the verbose switch and got: BUILD FAILED Caused by: java.io.IOException: Error while analyzing class news_cd.jar@news/news/news.jar@installableApps/news.ear@commons-codec-1.4.jar@org/apache/commons/codec/binary/Base64.class. Caused by: java.lang.IllegalStateException: Can't add different class with same name: org/apache/commons/codec/binary/Base64 As you can see, I'm using jar files and here is a case where there are nested jar and ear files. So far, the only way I was able to avoid the error was to exclude the entire news_cd.jar in the report generation build file: <structure name="Example Project"> <group name="mygroup"> <classfiles> <fileset dir="/local/ci/news/jars_original" excludes="news_cd.jar"/> </classfiles> </group> </structure> Is there a way to specify the the Base64 class or the entire commons-codec-1.4.jar in an exclusion when they are buried in a nested jar/ear file hierarchy?

          Phil Brown added a comment -

          Adding to the third point- I would like the ability to reference an environment variable for the configuration fields in the plugin. I keep a file containing the exclusions for the file filters, and locally have a way to parse this file out, however I prefer using this plugin because it will consume all of the output files and show the information intuitively.

          Phil Brown added a comment - Adding to the third point- I would like the ability to reference an environment variable for the configuration fields in the plugin. I keep a file containing the exclusions for the file filters, and locally have a way to parse this file out, however I prefer using this plugin because it will consume all of the output files and show the information intuitively.

            ognjenb Ognjen Bubalo
            adrianp Adrian Price
            Votes:
            3 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: