• Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Major Major
    • maven-plugin
    • None

      Hudson maven-plugin doesn't work with Maven 3 on Linux. On Linux Hudson builds its own Java command line and does some additional magic to launch Maven. On Windows it works fine because mvn.bat is used instead.

      The mechanism on Linux fails for two reasons:

      1. classworlds-*.jar was upgraded to plexus-classworlds-2.2.2 with Maven 3, so the classpath is wrong.

      2. plexus-classworlds-2.2.2 is not fully backward compatible. After renaming the jar to classworlds-2.2.2.jar the error is:

      $ /opt/java/x86_64/jdk1.6.0_16/bin/java -Xmx768m -XX:MaxPermSize=256m -cp /home/hudson/plugins/maven-plugin/WEB-INF/lib/maven-agent-1.335.jar:/opt/maven/3.0-alpha-5/boot/classworlds-2.2.2.jar hudson.maven.agent.Main /opt/maven/3.0-alpha-5 /usr/share/tomcat5/webapps/hudson/WEB-INF/lib/remoting-1.335.jar /home/hudson/plugins/maven-plugin/WEB-INF/lib/maven-interceptor-1.335.jar 32917
      Exception in thread "main" java.lang.NoSuchMethodError: org.codehaus.classworlds.Launcher.getWorld()Lorg/codehaus/classworlds/ClassWorld;
      at hudson.maven.agent.Main.main(Main.java:115)
      at hudson.maven.agent.Main.main(Main.java:62)
      ERROR: Failed to launch Maven. Exit code = 1
      Skipping sonar analysis due to bad build status FAILURE
      Finished: FAILURE

      Reason for the above error is that getWorld() returns a different type in 2.2.2 which isn't assignable to the type returned in 1.x.

      A general question: Why does Hudson use different mechanisms for launching Maven on Windows and Linux?

      Tested with 1.335

          [JENKINS-4988] Maven 3 support in maven-plugin

          Olivier Lamy added a comment -

          @unguiculus I have fixed more stuff in JENKINS-8387 (mirrors not used) so probably you have mirrors where maven should be able to download the parent.
          you can try with this build :
          wget http://people.apache.org/~olamy/hudson/main-maven3-support/hudson.war

          Olivier Lamy added a comment - @unguiculus I have fixed more stuff in JENKINS-8387 (mirrors not used) so probably you have mirrors where maven should be able to download the parent. you can try with this build : wget http://people.apache.org/~olamy/hudson/main-maven3-support/hudson.war

          I had the same problem yesterday with a maven project still using 2, with 1.392, so I tried the snapshot to no effect. I think the problem is the maven-plugin was not updated, since when I downgraded, I had to reinstall 1.391's maven-plugin. If I have time to day, I'll try to play with this. I thought hudson would overwrite the maven-plugin, since it is pinned, but it doesn't appear to have done that. Maybe if you also put the maven-plugin.hpi next to your hudson.war that would help too.

          Larry Shatzer, Jr. added a comment - I had the same problem yesterday with a maven project still using 2, with 1.392, so I tried the snapshot to no effect. I think the problem is the maven-plugin was not updated, since when I downgraded, I had to reinstall 1.391's maven-plugin. If I have time to day, I'll try to play with this. I thought hudson would overwrite the maven-plugin, since it is pinned, but it doesn't appear to have done that. Maybe if you also put the maven-plugin.hpi next to your hudson.war that would help too.

          unguiculus added a comment -

          @olamy: As I mentioned, this is exactly the version I was trying (1.393-SNAPSHOT (private-01/03/2011 18:16-olamy)) because I was hoping that the fix for JENKINS-8387 would fix the problem, which was not the case.

          unguiculus added a comment - @olamy: As I mentioned, this is exactly the version I was trying (1.393-SNAPSHOT (private-01/03/2011 18:16-olamy)) because I was hoping that the fix for JENKINS-8387 would fix the problem, which was not the case.

          Olivier Lamy added a comment -

          @lshatzer what is your issue ?
          At least logs could be helpfull.

          Olivier Lamy added a comment - @lshatzer what is your issue ? At least logs could be helpfull.

          It was a maven 2 project, with just referring to a corporate parent pom. I tried adding <relativePath/> with no luck. I even tried your snapshot, but as I said, I think the problem might have been the maven plugin was not updated to the snapshot version as well.

          Here is the log (sorry for not attaching it, as I was at home, and did not have it handy).

          Parsing POMs
          failed to transfer Error transferring file: central
          ERROR: Failed to parse POMs
          org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
          [FATAL] Non-resolvable parent POM: Could not transfer artifact com.company.parentpoms:utilities:pom:4.1.16 from/to central (http://central): Error transferring file: central and 'parent.relativePath' points at wrong local POM @ line 9, column 11
          
          	at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:325)
          	at hudson.maven.MavenEmbedder.readProjects(MavenEmbedder.java:382)
          	at hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:1096)
          	at hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:983)
          	at hudson.FilePath.act(FilePath.java:756)
          	at hudson.FilePath.act(FilePath.java:738)
          	at hudson.maven.MavenModuleSetBuild$RunnerImpl.parsePoms(MavenModuleSetBuild.java:690)
          	at hudson.maven.MavenModuleSetBuild$RunnerImpl.doRun(MavenModuleSetBuild.java:526)
          	at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:417)
          	at hudson.model.Run.run(Run.java:1365)
          	at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:400)
          	at hudson.model.ResourceController.execute(ResourceController.java:88)
          	at hudson.model.Executor.run(Executor.java:145)
          
          

          Larry Shatzer, Jr. added a comment - It was a maven 2 project, with just referring to a corporate parent pom. I tried adding <relativePath/> with no luck. I even tried your snapshot, but as I said, I think the problem might have been the maven plugin was not updated to the snapshot version as well. Here is the log (sorry for not attaching it, as I was at home, and did not have it handy). Parsing POMs failed to transfer Error transferring file: central ERROR: Failed to parse POMs org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs: [FATAL] Non-resolvable parent POM: Could not transfer artifact com.company.parentpoms:utilities:pom:4.1.16 from/to central (http: //central): Error transferring file: central and 'parent.relativePath' points at wrong local POM @ line 9, column 11 at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:325) at hudson.maven.MavenEmbedder.readProjects(MavenEmbedder.java:382) at hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:1096) at hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:983) at hudson.FilePath.act(FilePath.java:756) at hudson.FilePath.act(FilePath.java:738) at hudson.maven.MavenModuleSetBuild$RunnerImpl.parsePoms(MavenModuleSetBuild.java:690) at hudson.maven.MavenModuleSetBuild$RunnerImpl.doRun(MavenModuleSetBuild.java:526) at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:417) at hudson.model.Run.run(Run.java:1365) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:400) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:145)

          Olivier Lamy added a comment -

          @lshatzer have a look at JENKINS-8390 and if last build doesn't put a comment in JENKINS-8390

          Olivier Lamy added a comment - @lshatzer have a look at JENKINS-8390 and if last build doesn't put a comment in JENKINS-8390

          Code changed in hudson
          User: Olivier Lamy
          Path:
          changelog.html
          http://hudson-labs.org/commit/core/18f4a8ebc0516bc1a88b78067a058140a673a152
          Log:
          update changelog with JENKINS-4988

          SCM/JIRA link daemon added a comment - Code changed in hudson User: Olivier Lamy Path: changelog.html http://hudson-labs.org/commit/core/18f4a8ebc0516bc1a88b78067a058140a673a152 Log: update changelog with JENKINS-4988

          Nathan Parry added a comment -

          For the folks having issues with downloading your corporate parent POM - I had the same problem and it turned out to be a regression in Maven (MNG-4963) which is supposed to be fixed in Maven 3.0.3.

          Nathan Parry added a comment - For the folks having issues with downloading your corporate parent POM - I had the same problem and it turned out to be a regression in Maven ( MNG-4963 ) which is supposed to be fixed in Maven 3.0.3.

          Nathan Parry added a comment -

          I guess for greater searchability for others unfortunate enough to have the same problem as me - The exact error message I got was:

          Non-resolvable parent POM: Could not find artifact mycompany:myparent:pom:myversion and 'parent.relativePath' points at wrong local POM

          ...And the suggested workaround for MNG-4963 worked for me. This was using Jenkins 1.399 which looks like it uses Maven 3.0.2 internally.

          Nathan Parry added a comment - I guess for greater searchability for others unfortunate enough to have the same problem as me - The exact error message I got was: Non-resolvable parent POM: Could not find artifact mycompany:myparent:pom:myversion and 'parent.relativePath' points at wrong local POM ...And the suggested workaround for MNG-4963 worked for me. This was using Jenkins 1.399 which looks like it uses Maven 3.0.2 internally.

          Olivier Lamy added a comment -

          as someone requested : fix for 1.392 version

          Olivier Lamy added a comment - as someone requested : fix for 1.392 version

            olamy Olivier Lamy
            zlosch zlosch
            Votes:
            155 Vote for this issue
            Watchers:
            138 Start watching this issue

              Created:
              Updated:
              Resolved: