0
votes

I am trying to get modules in my pom.xml by using below command. This was working till yesterday. Maven artfiact is stored in artifactory and am using .m2/settings.xml to connect to central and download artifacts. I am sure there was not interaction in jenkins and artifactory but suddenly stared seeing failures

I have tried changing M2_HOME/MAVEN_HOME to M3_home. Tried to delete .m2/repository and ran mvn command to download again

Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T14:49:05-05:00) Maven home: /Users/jenkins/Downloads/apache-maven-3.5.3 Java version: 1.8.0_172, vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home/jre Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "10.14.2", arch: "x86_64", family: "mac"

mvn help:evaluate -Dexpression=project.modules -B
Expected

[Info] Downloading ....
[Info] Downloaded ....
[Info]....
[Info]....
[Info]....
[Info]....
<modules>
  <module>example-mod1</module>
  <module>example-mod2</module>
  <module>example-mod3</module>
</modules>
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 31.185 s
[INFO] Finished at: 2019-04-17T16:52:52-04:00
[INFO] ------------------------------------------------------------------------
Actual

[Info] Downloading ....
[Info] Downloaded ....
[Info]....
[Info]....
[Info]....
[Info]....
[ERROR]
java.lang.ClassNotFoundException: org.apache.maven.model.io.xpp3.MavenXpp3WriterEx
    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)
    at java.lang.Class.forName0 (Native Method)
    at java.lang.Class.forName (Class.java:348)
    at org.apache.commons.lang3.ClassUtils.getClass (ClassUtils.java:993)
    at org.apache.commons.lang3.ClassUtils.getClass (ClassUtils.java:1059)
    at org.apache.commons.lang3.ClassUtils.getClass (ClassUtils.java:1042)
    at org.apache.maven.plugins.help.EvaluateMojo.addAlias (EvaluateMojo.java:542)
    at org.apache.maven.plugins.help.EvaluateMojo.addAlias (EvaluateMojo.java:491)
    at org.apache.maven.plugins.help.EvaluateMojo.getXStream (EvaluateMojo.java:455)
    at org.apache.maven.plugins.help.EvaluateMojo.toXML (EvaluateMojo.java:420)
    at org.apache.maven.plugins.help.EvaluateMojo.handleResponse (EvaluateMojo.java:381)
    at org.apache.maven.plugins.help.EvaluateMojo.execute (EvaluateMojo.java:214)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    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)
[INFO]
<strings>
  <string>example-mod1</string>
  <string>example-mod2</string>
  <string>example-mod3</string>
</strings>
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 31.185 s
[INFO] Finished at: 2019-04-17T16:52:52-04:00
[INFO] ------------------------------------------------------------------------
1

1 Answers

1
votes

The class MavenXPP3writerEx seems to be available only in Maven 3.6.1 API.

If you are using Maven 3.3.9, or any release prior to 3.6.1, then you will have this message: you try to use the latest version of the maven-help-plugin (designed to be compatible with Maven 3.6.1), but not retro-compatible with earlier versions.

Then, to use a compatible version you must restrain the version of the maven-help-plugin in order to use it without errors. To do so, define a pluginManagement section in you POM and declare the maven-help-plugin with version 3.1.0 (for Maven 3.3.9). I did not try with another Maven configuration.