Java – unable to run the program “MVN” error = 2, there is no such file or directory

I'm building on Ubuntu 14.04 LTS, but I get the following:

Started by user anonymous
Building in workspace /var/lib/jenkins/workspace/videovixx
> /usr/bin/git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> /usr/bin/git config remote.origin.url https://bitbucket.org/mdennis10/videovixx.git #     timeout=10
Fetching upstream changes from https://bitbucket.org/mdennis10/videovixx.git
> /usr/bin/git --version # timeout=10
using .gitcredentials to set credentials
> /usr/bin/git config --local credential.helper store --    file=/tmp/git6236060328558794078.credentials # timeout=10
> /usr/bin/git fetch --tags --progress https://bitbucket.org/mdennis10/videovixx.git   +refs/heads/*:refs/remotes/origin/*
> /usr/bin/git config --local --remove-section credential # timeout=10
> /usr/bin/git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> /usr/bin/git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10

Check out revision f5c53e95d33c1e15abd7519346c18ec6bc0c81d7 (refs / remotes / origin / Master)

> /usr/bin/git config core.sparsecheckout # timeout=10
  > /usr/bin/git checkout -f f5c53e95d33c1e15abd7519346c18ec6bc0c81d7
> /usr/bin/git rev-list f5c53e95d33c1e15abd7519346c18ec6bc0c81d7 # timeout=10
[videovixx] $mvn install package
FATAL: command execution Failed
java.io.IOException: Cannot run program "mvn" (in directory    "/var/lib/jenkins/workspace/videovixx"): error=2,No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047)
at hudson.Proc$LocalProc.<init>(Proc.java:244)
at hudson.Proc$LocalProc.<init>(Proc.java:216)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:802)
at hudson.Launcher$ProcStarter.start(Launcher.java:380)
at hudson.Launcher$ProcStarter.join(Launcher.java:387)
at hudson.tasks.Maven.perform(Maven.java:328)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:770)
at hudson.model.Build$BuildExecution.build(Build.java:199)
at hudson.model.Build$BuildExecution.doRun(Build.java:160)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:533)
at hudson.model.Run.execute(Run.java:1745)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:89)
at hudson.model.Executor.run(Executor.java:240)
Caused by: java.io.IOException: error=2,No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:186)
at java.lang.ProcessImpl.start(ProcessImpl.java:130)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028)
... 15 more
Build step 'Invoke top-level Maven targets' marked build as failure
Archiving artifacts
Recording test results
Finished: FAILURE

I assume that the creation of / var / lib / Jenkins / workspace / videovixx does not have the correct permissions due to some Linux security functions. I may not have this problem. How can I solve it?

Solution

There's a lot of stuff.

You did not select Maven version in job configuration Or you have not configured Jenkins to install the Maven version Or you want to use locally installed Maven on the slave station, but you are not configured as a Jenkins user

Since I don't know what you have configured (or not) and what you expect to use, I can't answer directly, but I can explain how it works

If you want to use locally installed Maven on the master / slave machine

>You must install Maven locally > you must be able to launch it using the Jenkins user

>Execute sudo Jenkins, and then execute MVN on your slave to verify whether Jenkins users can run MVN > if it fails, you need to install / configure Maven correctly

>In the job configuration, you must select "default" for Maven version This is the setting to use the version installed locally on the node

If you want Jenkins to install Maven for you

>You must go to Jenkins global configuration and configure the Maven version using the automatic installer (from the web). > In job configuration, you must select the specific version you just configured

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>