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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • pipeline-maven-plugin
    • None
    • 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

      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.

       

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

              Created:
              Updated:
              Resolved: