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

mvn executable cannot be found on slave in invoke top-level Maven targets step in free-style software project

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Blocker Blocker
    • maven-plugin
    • None
    • Platform: All, OS: All

      When trying to execute Maven 2 executable on slave node from a build configured
      as "free-style software project" and a build step of type "Invoke top-level
      Maven targets" it cannot find mvn executable:

      Started by user krystian.nowak
      Building remotely on slave01.myorg.org
      Updating https://svn.myorg.org/trunk
      At revision 35030
      no change for https://svn.myorg.org/trunk since the previous build
      [ant] $ ant -file build.xml
      Buildfile: build.xml

      update-settings:
      [copy] Copying 1 file to /home/tomcat/.hudson/workspace/common-resources-public

      BUILD SUCCESSFUL
      Total time: 0 seconds
      [trunk] $ mvn -f java/pom.xml clean install
      FATAL: command execution failed
      java.io.IOException: Cannot run program "mvn" (in directory
      "/home/tomcat/.hudson/workspace/common-resources-public/trunk"):
      java.io.IOException: error=2, No such file or directory
      at java.lang.ProcessBuilder.start(ProcessBuilder.java:459)
      at hudson.Proc$LocalProc.<init>(Proc.java:132)
      at hudson.Proc$LocalProc.<init>(Proc.java:110)
      at hudson.Launcher$LocalLauncher.createLocalProc(Launcher.java:359)
      at hudson.Launcher$LocalLauncher.launch(Launcher.java:342)
      at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:501)
      at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:485)
      at hudson.remoting.UserRequest.perform(UserRequest.java:92)
      at hudson.remoting.UserRequest.perform(UserRequest.java:46)
      at hudson.remoting.Request$2.run(Request.java:236)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      at
      java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:619)
      Caused by: java.io.IOException: java.io.IOException: error=2, No such file or
      directory
      at java.lang.UNIXProcess.<init>(UNIXProcess.java:148)
      at java.lang.ProcessImpl.start(ProcessImpl.java:65)
      at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
      ... 15 more
      Recording test results
      Sending e-mails to: failures@myorg.org
      Finished: FAILURE

      It does not happen if it is built on master node.

      It does not occur for "maven2 project" type.

      On slave node mvn is in exactly the same place as on master node:
      [tomcat@slave01 ~]$ which mvn
      /usr/local/maven/bin/mvn
      [tomcat@master ~]$ which mvn
      /usr/local/maven/bin/mvn

      Top level Maven 2 configuration is:
      Maven installation:
      name: 2.0
      MAVEN_HOME: /usr/local/maven

      Hudson ver. 1.297
      Maven Integration plugin ver. 1.297
      Hudson SSH Slaves plugin ver. 0.4
      (Launch method: Launch slave agents on Linux machines via SSH)

          [JENKINS-3474] mvn executable cannot be found on slave in invoke top-level Maven targets step in free-style software project

          adding myself as CC

          Krystian Nowak added a comment - adding myself as CC

          I have the same issue here :
          http://builder.exoplatform.org/hudson/job/gatein-common-trunk/16/jdk=jdk-6.0/console
          http://builder.exoplatform.org/hudson/job/gatein-common-trunk/16/jdk=jdk-5.0/console
          I asked to hudson to install Maven and JDKs
          A user said (http://markmail.org/message/ovttwv3grcr6lhw7) it fixed it by adding mvn in its account
          PATH but I don't want to do that. I want to be free to select the version of maven I use in Hudson (And I'll
          probably have several versions in the future to test maven upgrades)

          Arnaud Héritier added a comment - I have the same issue here : http://builder.exoplatform.org/hudson/job/gatein-common-trunk/16/jdk=jdk-6.0/console http://builder.exoplatform.org/hudson/job/gatein-common-trunk/16/jdk=jdk-5.0/console I asked to hudson to install Maven and JDKs A user said ( http://markmail.org/message/ovttwv3grcr6lhw7 ) it fixed it by adding mvn in its account PATH but I don't want to do that. I want to be free to select the version of maven I use in Hudson (And I'll probably have several versions in the future to test maven upgrades)

          Using hudson-installed versions of Maven and Java in a multi-configuration project doesn't work. It works
          in free-style or maven 2 projects

          Arnaud Héritier added a comment - Using hudson-installed versions of Maven and Java in a multi-configuration project doesn't work. It works in free-style or maven 2 projects

          Sorry I just saw that I don't have freestyle projects anymore. Those it works probably in maven 2 projects
          but not for others types.

          Arnaud Héritier added a comment - Sorry I just saw that I don't have freestyle projects anymore. Those it works probably in maven 2 projects but not for others types.

          Andrew Bayer added a comment -

          Is this still an issue? I've had no problem with this in my test bed now.

          Andrew Bayer added a comment - Is this still an issue? I've had no problem with this in my test bed now.

          Dmitry Maslakov added a comment - - edited

          Yes, it's still an issue (ver 1.414).

          1. I occasionally used auto-installed maved for free-style project. But after I removed tool files from slave's file system... they did not appeared again, even after jumping and tricking like turn-off and turn-on auto-installer, change version, etc.
          2. In heterogeneous environment (Linux+Windows) I can't even effectively specify the MAVEN_HOME parameter for tool. It does not appear as MAVEN_HOME in environment, it does not appear in PATH.
          3. And as last resort, I cannot define own variable PATH="$PATH:path_to_maven" in Jenkins configuration plus use https://wiki.jenkins-ci.org/display/JENKINS/Cygpath+Plugin because it removes paths configured on slave node, and for Windows slaves it does not transform path_to_maven into native Windows path.

          Dmitry Maslakov added a comment - - edited Yes, it's still an issue (ver 1.414). 1. I occasionally used auto-installed maved for free-style project. But after I removed tool files from slave's file system... they did not appeared again, even after jumping and tricking like turn-off and turn-on auto-installer, change version, etc. 2. In heterogeneous environment (Linux+Windows) I can't even effectively specify the MAVEN_HOME parameter for tool. It does not appear as MAVEN_HOME in environment, it does not appear in PATH. 3. And as last resort, I cannot define own variable PATH="$PATH:path_to_maven" in Jenkins configuration plus use https://wiki.jenkins-ci.org/display/JENKINS/Cygpath+Plugin because it removes paths configured on slave node, and for Windows slaves it does not transform path_to_maven into native Windows path.

          Anthony Green added a comment -

          This is also happens with a Linux Masters and OS X slaves

          Anthony Green added a comment - This is also happens with a Linux Masters and OS X slaves

            Unassigned Unassigned
            krystian_nowak Krystian Nowak
            Votes:
            5 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: