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

ClassNotFoundException org.joda.time.ReadablePartial: Jacoco plugin does not work after update from 2.1.0 to 2.2.0

    XMLWordPrintable

Details

    Description

      After update to version 2.2.0 Jacoco plugin does not work any longer.

      ERROR: Step 'Record JaCoCo coverage report' aborted due to exception: 
      java.lang.ClassNotFoundException: org.joda.time.ReadablePartial
      	at java.lang.ClassLoader.findClass(Unknown Source)
      	at java.lang.ClassLoader.loadClass(Unknown Source)
      	at hudson.util.MaskingClassLoader.loadClass(MaskingClassLoader.java:75)
      	at java.lang.ClassLoader.loadClass(Unknown Source)
      	at org.apache.tools.ant.AntClassLoader.findBaseClass(AntClassLoader.java:1387)
      	at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1080)
      	at java.lang.ClassLoader.loadClass(Unknown Source)
      Caused: java.lang.NoClassDefFoundError: org/joda/time/ReadablePartial
      	at hudson.plugins.jacoco.JacocoPublisher.perform(JacocoPublisher.java:642)
      	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:779)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720)
      	at hudson.model.Build$BuildExecution.post2(Build.java:186)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:665)
      	at hudson.model.Run.execute(Run.java:1758)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      	at hudson.model.ResourceController.execute(ResourceController.java:97)
      	at hudson.model.Executor.run(Executor.java:405)
      

      Attachments

        Activity

          I can confirm this issue exists in the 2.2.0 version

          ventura8 Sergiu Alexandrescu added a comment - I can confirm this issue exists in the 2.2.0 version
          oleg_nenashev Oleg Nenashev added a comment -

          Likely it is a binary compatibility issue with other plugins suing Joda-time: https://github.com/search?utf8=%E2%9C%93&q=org%3Ajenkinsci+%22artifactId+joda-time%3C%2FartifactId%3E%22&type=Code . JaCoCo plugin gets it as a transient dependency from another plugin, hence there may be various collisions

          oleg_nenashev Oleg Nenashev added a comment - Likely it is a binary compatibility issue with other plugins suing Joda-time: https://github.com/search?utf8=%E2%9C%93&q=org%3Ajenkinsci+%22artifactId+joda-time%3C%2FartifactId%3E%22&type=Code . JaCoCo plugin gets it as a transient dependency from another plugin, hence there may be various collisions
          mdeanda miguel deanda added a comment -

          i've confirmed that disabling these 2 options lets it work:

           

          Change build status according the thresholds

           

           

          Fail the build if coverage degrades more than the delta thresholds

           

          i had a small project with only the following configured in the pom:

          <dependencies>
           <dependency>
           <groupId>junit</groupId>
           <artifactId>junit</artifactId>
           <version>4.10</version>
           <scope>test</scope>
           </dependency>
           <dependency>
           <groupId>org.apache.commons</groupId>
           <artifactId>commons-lang3</artifactId>
           <version>3.5</version>
           </dependency>
           <dependency>
           <groupId>log4j</groupId>
           <artifactId>log4j</artifactId>
           <version>1.2.17</version>
           </dependency>
          </dependencies>
          <build>
           <defaultGoal>package</defaultGoal>
           <plugins>
           <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-compiler-plugin</artifactId>
           <version>2.0.2</version>
           <configuration>
           <source>1.8</source>
           <target>1.8</target>
           <encoding>UTF-8</encoding>
           <debug>true</debug>
           </configuration>
           </plugin>
           <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-surefire-plugin</artifactId>
           <version>2.18.1</version>
           <configuration>
           <argLine>${argLine}</argLine>
           <skipTests>${skipTests}</skipTests>
           <parallel>methods</parallel>
           <threadCount>2</threadCount>
           <systemProperties>
           <run.test.local>${run.test.local}</run.test.local>
           </systemProperties>
           </configuration>
           <executions>
           <execution>
           <goals>
           <goal>test</goal>
           </goals>
           </execution>
           </executions>
           </plugin>
           <plugin>
           <groupId>org.jacoco</groupId>
           <artifactId>jacoco-maven-plugin</artifactId>
           <version>0.7.9</version>
           <executions>
           <execution>
           <goals>
           <goal>prepare-agent</goal>
           </goals>
           </execution>
           <execution>
           <id>report</id>
           <phase>prepare-package</phase>
           <goals>
           <goal>report</goal>
           </goals>
           </execution>
           </executions>
           </plugin>
           </plugins>
          </build>
          mdeanda miguel deanda added a comment - i've confirmed that disabling these 2 options lets it work:   Change build status according the thresholds     Fail the build if coverage degrades more than the delta thresholds   i had a small project with only the following configured in the pom: <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.10</version> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>3.5</version> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.17</version> </dependency> </dependencies> <build> <defaultGoal>package</defaultGoal> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.0.2</version> <configuration> <source>1.8</source> <target>1.8</target> <encoding>UTF-8</encoding> <debug>true</debug> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.18.1</version> <configuration> <argLine>${argLine}</argLine> <skipTests>${skipTests}</skipTests> <parallel>methods</parallel> <threadCount>2</threadCount> <systemProperties> <run.test.local>${run.test.local}</run.test.local> </systemProperties> </configuration> <executions> <execution> <goals> <goal>test</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <version>0.7.9</version> <executions> <execution> <goals> <goal>prepare-agent</goal> </goals> </execution> <execution> <id>report</id> <phase>prepare-package</phase> <goals> <goal>report</goal> </goals> </execution> </executions> </plugin> </plugins> </build>
          llamahunter Richard Lee added a comment -

          I think the pom.xml for jacoco is missing a dependency on joda-time. It definitely directly uses it in some classes, but was just getting lucky that some other library had included it in the classpath.

          llamahunter Richard Lee added a comment - I think the pom.xml for jacoco is missing a dependency on joda-time. It definitely directly uses it in some classes, but was just getting lucky that some other library had included it in the classpath.
          llamahunter Richard Lee added a comment -

          I made a custom build of the jacoco plugin and deployed it to my jenkins server, but added

                <!-- https://mvnrepository.com/artifact/joda-time/joda-time -->
                <dependency>
                   <groupId>joda-time</groupId>
                   <artifactId>joda-time</artifactId>
                   <version>2.9.9</version>
                </dependency>
          

          to the plugin's pom.xml. Seems to have fixed the problem.

          llamahunter Richard Lee added a comment - I made a custom build of the jacoco plugin and deployed it to my jenkins server, but added <!-- https://mvnrepository.com/artifact/joda-time/joda-time --> <dependency> <groupId>joda-time</groupId> <artifactId>joda-time</artifactId> <version>2.9.9</version> </dependency> to the plugin's pom.xml. Seems to have fixed the problem.

          Code changed in jenkins
          User: Alexander Veit
          Path:
          src/main/java/hudson/plugins/jacoco/portlet/JacocoLoadData.java
          src/main/java/hudson/plugins/jacoco/portlet/chart/JacocoBuilderTrendChart.java
          src/main/java/hudson/plugins/jacoco/portlet/utils/Utils.java
          src/test/java/hudson/plugins/jacoco/portlet/utils/UtilsHudsonTest.java
          http://jenkins-ci.org/commit/jacoco-plugin/f24f927000a65a12103c4d2f5d3094eda9b76969
          Log:
          Remove Joda Time dependency (JENKINS-43103). (#87)

          Removed dependency to Joda Time (JENKINS-43103)

          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Alexander Veit Path: src/main/java/hudson/plugins/jacoco/portlet/JacocoLoadData.java src/main/java/hudson/plugins/jacoco/portlet/chart/JacocoBuilderTrendChart.java src/main/java/hudson/plugins/jacoco/portlet/utils/Utils.java src/test/java/hudson/plugins/jacoco/portlet/utils/UtilsHudsonTest.java http://jenkins-ci.org/commit/jacoco-plugin/f24f927000a65a12103c4d2f5d3094eda9b76969 Log: Remove Joda Time dependency ( JENKINS-43103 ). (#87) Removed dependency to Joda Time ( JENKINS-43103 )
          centic centic added a comment -

          On master the dependency is removed now thanks to the patch from veita, will be included in the next minor release.

          centic centic added a comment - On master the dependency is removed now thanks to the patch from veita , will be included in the next minor release.
          centic centic added a comment - - edited

          release was tagged just now, I had some trouble pushing to the maven-repo, but seems to be uploaded nevertheless, should be available soon, please ping me if it does not become available for you.

          centic centic added a comment - - edited release was tagged just now, I had some trouble pushing to the maven-repo, but seems to be uploaded nevertheless, should be available soon, please ping me if it does not become available for you.

          People

            centic centic
            alexanderv Alexander Veit
            Votes:
            4 Vote for this issue
            Watchers:
            11 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: