We recently ran into an issue where the version of Maven under FreeBSD wasn’t updated enough (ports/pkg was behind) for the version of Jenkins in ports/pkg.

It produced an error like the following:

[INFO] Installing /usr/local/jenkins/workspace/bdd_framework_test/pom.xml to /usr/local/jenkins/.m2/repository/Cucumber_Framework/BDD_SearchLock_Safelist_Final/0.0.1-SNAPSHOT/BDD_SearchLock_Safelist_Final-0.0.1-SNAPSHOT.pom
[WARNING] Attempt to (de-)serialize anonymous class hudson.maven.reporters.MavenArtifactArchiver$2; see: https://jenkins.io/redirect/serialization-of-anonymous-classes/
java.lang.reflect.InvocationTargetException
    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.launchStandard(Launcher.java:329)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
    at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:181)
    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 hudson.maven.Maven3Builder.call(Maven3Builder.java:139)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:70)
    at hudson.remoting.UserRequest.perform(UserRequest.java:212)
    at hudson.remoting.UserRequest.perform(UserRequest.java:54)
    at hudson.remoting.Request$2.run(Request.java:369)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NoSuchMethodError: org.apache.maven.project.MavenProject.getProjectBuildingRequest()Lorg/apache/maven/project/ProjectBuildingRequest;
    at hudson.maven.reporters.MavenFingerprinter.getLocalRepository(MavenFingerprinter.java:162)
    at hudson.maven.reporters.MavenFingerprinter.recordParents(MavenFingerprinter.java:142)
    at hudson.maven.reporters.MavenFingerprinter.postBuild(MavenFingerprinter.java:110)
    at hudson.maven.Maven3Builder$MavenExecutionListener.recordProjectEnded(Maven3Builder.java:555)
    at hudson.maven.Maven3Builder$MavenExecutionListener.projectSucceeded(Maven3Builder.java:533)
    at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:68)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:91)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:314)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:151)
    at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:117)
    ... 21 more
ERROR: Failed to parse POMs

Lots of post say to update Maven or similar, however because the FreeBSD port/pkg of Maven is behind you need to manually grab the latest version http://apache.mirror.uber.com.au/maven/maven-3/ and extract them into the following locations

/usr/local/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven/
and
/usr/local/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven_Home/

And after restarting Jenkins you should be good to go!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.