• 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

          zlosch created issue -

          zlosch added a comment -

          I have to correct myself. It's not working both on Windows and on Linux. The working job I've seen on Windows wasn't a real Maven job but a free-style job with a Maven build step (and that's invoked with mvn.bat).

          Any updates on the issue?

          zlosch added a comment - I have to correct myself. It's not working both on Windows and on Linux. The working job I've seen on Windows wasn't a real Maven job but a free-style job with a Maven build step (and that's invoked with mvn.bat). Any updates on the issue?
          zlosch made changes -
          Summary Original: maven-plugin not working with Maven 3 on Linux New: maven-plugin not working with Maven 3
          zlosch made changes -
          Link New: This issue depends on JENKINS-5360 [ JENKINS-5360 ]

          mragab added a comment -

          There is a bug in maven 2.x which is only fixed in maven 3.0
          <profile><activation><file><exists/> does not work in a multi-project build
          http://jira.codehaus.org/browse/MNG-2363
          With this bug there not a working combination of maven and hudson that can use a file for activating a profile in a multi-module project

          mragab added a comment - There is a bug in maven 2.x which is only fixed in maven 3.0 <profile><activation><file><exists/> does not work in a multi-project build http://jira.codehaus.org/browse/MNG-2363 With this bug there not a working combination of maven and hudson that can use a file for activating a profile in a multi-module project

          Maven 3 has a new build plan and lifecycle API that would be a better option for integration in Hudson.

          Nicolas De Loof added a comment - Maven 3 has a new build plan and lifecycle API that would be a better option for integration in Hudson.

          davidkarlsen added a comment -

          This issue becomes a little more pressing now as maven 3 is officially released.

          davidkarlsen added a comment - This issue becomes a little more pressing now as maven 3 is officially released.

          Just tried to move to official release of Maven 3.0 and finding Hudson 1.380 with java 6 on Linux (multiproject pom) does not work. All my hudson plugins are also updated to the latest releases.

          My job output:

          Parsing POMs
          [modules] $ /home/foo/hudson/tools/bin/java -cp /home/foo/hudson/plugins/maven-plugin/WEB-INF/lib/maven-agent-1.380.jar:/home/foo/apache-maven-3.0/boot/plexus-classworlds-2.2.3.jar hudson.maven.agent.Main /home/foo/apache-maven-3.0 /home/foo/hudson/war/WEB-INF/lib/remoting-1.380.jar /home/foo/hudson/plugins/maven-plugin/WEB-INF/lib/maven-interceptor-1.380.jar 53698
          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)
          Terminating xvnc.
          $ vncserver -kill :10
          Killing Xvnc process ID 13366
          ERROR: Failed to launch Maven. Exit code = 1

          If you web search for "Exception in thread "main" java.lang.NoSuchMethodError: org.codehaus.classworlds.Launcher.getWorld" you will see other people are hitting this too.

          The same project builds fine from the command line with "mvn install" on the the same Linux server using the same maven 3.0 and java version.

          jonathanjohnson added a comment - Just tried to move to official release of Maven 3.0 and finding Hudson 1.380 with java 6 on Linux (multiproject pom) does not work. All my hudson plugins are also updated to the latest releases. My job output: Parsing POMs [modules] $ /home/foo/hudson/tools/bin/java -cp /home/foo/hudson/plugins/maven-plugin/WEB-INF/lib/maven-agent-1.380.jar:/home/foo/apache-maven-3.0/boot/plexus-classworlds-2.2.3.jar hudson.maven.agent.Main /home/foo/apache-maven-3.0 /home/foo/hudson/war/WEB-INF/lib/remoting-1.380.jar /home/foo/hudson/plugins/maven-plugin/WEB-INF/lib/maven-interceptor-1.380.jar 53698 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) Terminating xvnc. $ vncserver -kill :10 Killing Xvnc process ID 13366 ERROR: Failed to launch Maven. Exit code = 1 If you web search for "Exception in thread "main" java.lang.NoSuchMethodError: org.codehaus.classworlds.Launcher.getWorld" you will see other people are hitting this too. The same project builds fine from the command line with "mvn install" on the the same Linux server using the same maven 3.0 and java version.
          Olivier Lamy made changes -
          Assignee New: Olivier Lamy [ olamy ]

          leoherbie added a comment -

          olamy,

          I see this issue does not have a fix version. Any idea when when might see Maven 3 support in Hudson?

          leoherbie added a comment - olamy, I see this issue does not have a fix version. Any idea when when might see Maven 3 support in Hudson?

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

              Created:
              Updated:
              Resolved: