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

Log spam "NoClassDefFoundError: org.apache.commons.lang3.StringUtils" when using Maven < 3.5

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: pipeline-maven-plugin
    • Labels:
      None
    • Environment:
      pipeline-maven-3.3.0 through pipeline-maven-3.5.1
      maven 3.2.x through maven 3.3.3
      Observed with Jenkins 2.107.1 and Jenkins 2.89.3
    • Similar Issues:

      Description

      ArtifactDeployedEventHandler was added to the plugin's maven event spy as part of https://issues.jenkins-ci.org/browse/JENKINS-49334 in this commit:  https://github.com/jenkinsci/pipeline-maven-plugin/commit/1b28437a157d0d309833debdb3d56f358f7a5708

       

      That class introduced an implicit dependency on commons lang3 at

      https://github.com/jenkinsci/pipeline-maven-plugin/blob/ea087d5e3491a815a8fcc65a2e41be2696eff2ee/maven-spy/src/main/java/org/jenkinsci/plugins/pipeline/maven/eventspy/handler/ArtifactDeployedEventHandler.java#L6

       

      When the plugin adds the maven spy as a maven extension (

      https://github.com/jenkinsci/pipeline-maven-plugin/blob/ea087d5e3491a815a8fcc65a2e41be2696eff2ee/jenkins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStepExecution.java#L329) it does not provide an implementation of commons lang 3, but instead expects maven to provide it.

       

      When using maven 3.2.x through maven 3.3.3, exceptions like this are thrown

       

      [WARNING] [jenkins-event-spy] Exception processing ARTIFACT_DEPLOYED
      java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils
      	at org.jenkinsci.plugins.pipeline.maven.eventspy.handler.ArtifactDeployedEventHandler.newElement(ArtifactDeployedEventHandler.java:56)
      	at org.jenkinsci.plugins.pipeline.maven.eventspy.handler.ArtifactDeployedEventHandler.newElement(ArtifactDeployedEventHandler.java:43)
      	at org.jenkinsci.plugins.pipeline.maven.eventspy.handler.ArtifactDeployedEventHandler.handle(ArtifactDeployedEventHandler.java:26)
      	at org.jenkinsci.plugins.pipeline.maven.eventspy.JenkinsMavenEventSpy.onEvent(JenkinsMavenEventSpy.java:164)
      	at org.apache.maven.eventspy.internal.EventSpyDispatcher.onEvent(EventSpyDispatcher.java:108)
      	at org.apache.maven.eventspy.internal.EventSpyRepositoryListener.artifactDeployed(EventSpyRepositoryListener.java:46)
      	at org.eclipse.aether.internal.impl.DefaultRepositoryEventDispatcher.dispatch(DefaultRepositoryEventDispatcher.java:112)
      	at org.eclipse.aether.internal.impl.DefaultRepositoryEventDispatcher.dispatch(DefaultRepositoryEventDispatcher.java:101)
      	at org.eclipse.aether.internal.impl.DefaultDeployer$EventCatapult.artifactDeployed(DefaultDeployer.java:548)
      	at org.eclipse.aether.internal.impl.DefaultDeployer$ArtifactUploadListener.transferSucceeded(DefaultDeployer.java:610)
      	at org.eclipse.aether.connector.basic.TransferTransportListener.transferSucceeded(TransferTransportListener.java:114)
      	at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:351)
      	at org.eclipse.aether.connector.basic.BasicRepositoryConnector.put(BasicRepositoryConnector.java:274)
      	at org.eclipse.aether.internal.impl.DefaultDeployer.deploy(DefaultDeployer.java:311)
      	at org.eclipse.aether.internal.impl.DefaultDeployer.deploy(DefaultDeployer.java:245)
      	at org.eclipse.aether.internal.impl.DefaultRepositorySystem.deploy(DefaultRepositorySystem.java:413)
      	at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:139)
      	at org.sonatype.nexus.maven.staging.deploy.strategy.AbstractDeployStrategy.deployUp(AbstractDeployStrategy.java:213)
      	at org.sonatype.nexus.maven.staging.deploy.strategy.DeferredDeployStrategy.finalizeDeploy(DeferredDeployStrategy.java:86)
      	at org.sonatype.nexus.maven.staging.deploy.DeployMojo.execute(DeployMojo.java:213)
      	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
      	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
      	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
      	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
      	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
      	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
      	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
      	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
      	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
      	at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
      Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang3.StringUtils
      	at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
      	at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
      	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
      	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
      	... 41 more
        

      Commons lang 3 was not introduced to maven until 3.3.9.

       

        Attachments

          Activity

          Show
          tneeriemer Troy Neeriemer added a comment - PR for fix:   https://github.com/jenkinsci/pipeline-maven-plugin/pull/143
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Troy Neeriemer
          Path:
          maven-spy/src/main/java/org/jenkinsci/plugins/pipeline/maven/eventspy/handler/ArtifactDeployedEventHandler.java
          http://jenkins-ci.org/commit/pipeline-maven-plugin/863cf16a33f9ddcd51fb30216ff1d9e48a1d514c
          Log:
          JENKINS-50793 Remove implicit dependency on Apache commons lang 3.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Troy Neeriemer Path: maven-spy/src/main/java/org/jenkinsci/plugins/pipeline/maven/eventspy/handler/ArtifactDeployedEventHandler.java http://jenkins-ci.org/commit/pipeline-maven-plugin/863cf16a33f9ddcd51fb30216ff1d9e48a1d514c Log: JENKINS-50793 Remove implicit dependency on Apache commons lang 3.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Cyrille Le Clerc
          Path:
          maven-spy/src/main/java/org/jenkinsci/plugins/pipeline/maven/eventspy/handler/ArtifactDeployedEventHandler.java
          http://jenkins-ci.org/commit/pipeline-maven-plugin/5c8d017253837148e747b3d7373271f0c710ea12
          Log:
          Merge pull request #143 from tneer/JENKINS-50793

          JENKINS-50793 Remove implicit dependency on Apache commons lang 3.

          Compare: https://github.com/jenkinsci/pipeline-maven-plugin/compare/ea087d5e3491...5c8d01725383

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Cyrille Le Clerc Path: maven-spy/src/main/java/org/jenkinsci/plugins/pipeline/maven/eventspy/handler/ArtifactDeployedEventHandler.java http://jenkins-ci.org/commit/pipeline-maven-plugin/5c8d017253837148e747b3d7373271f0c710ea12 Log: Merge pull request #143 from tneer/ JENKINS-50793 JENKINS-50793 Remove implicit dependency on Apache commons lang 3. Compare: https://github.com/jenkinsci/pipeline-maven-plugin/compare/ea087d5e3491...5c8d01725383
          Hide
          cleclerc Cyrille Le Clerc added a comment -

          Fixed in Jenkins Pipeline Maven Plugin 3.5.3

          Show
          cleclerc Cyrille Le Clerc added a comment - Fixed in Jenkins Pipeline Maven Plugin 3.5.3

            People

            • Assignee:
              tneeriemer Troy Neeriemer
              Reporter:
              tneeriemer Troy Neeriemer
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: