无法运行程序“mvn” error = 2,没有这样的文件或目录 [英] Cannot run program "mvn" error=2, No such file or directory
问题描述
我正在使用我的Ubuntu 14.04 LTS进行构建但是我得到以下内容:
I'm doing a build on my Ubuntu 14.04 LTS but I'm getting 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
Checking 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
我假设这是由某些Linux安全功能引起的阻止创建/ var / lib / jenkins / workspace / videovixx而没有正确的权限
我可能没有。这是问题,我该如何解决?
I'm assuming that this caused by some linux security feature that stops the /var/lib/jenkins/workspace/videovixx from being created without the correct permissions which I might not have. Is this the problem and how do I solve it?
推荐答案
这里有很多东西。
您未在作业配置中选择Maven版本。
或者您没有配置Jenkins来安装Maven版本。
或者您希望在Slave上使用本地安装的Maven,但它没有为 jenkins
用户配置。
You either didn't select Maven version in Job configuration.
Or you didn't configure Jenkins to install a Maven version.
Or you expected to use locally installed Maven on the Slave, but it's not configured for jenkins
user.
由于我不知道你配置了什么(或没有配置)以及你期望使用什么,我不能直接回答,但我可以解释它是如何工作的。
Since I don't know what you've configured (or didn't configure) and what you expected to use, I can't answer directly, but I can explain how it works.
- 你必须在本地安装Maven
- 您必须能够使用
jenkins启动它
用户
- You must have Maven locally installed
- You must be able to launch it with
jenkins
user
- 执行
sudo jenkins
,然后在你的Slave上执行mvn
以验证jenkins
用户可以运行mvn
- 如果失败,则需要正确安装/配置Maven
- Execute
sudo jenkins
, and then executemvn
on your Slave to verify thatjenkins
user can runmvn
- If that fails, you need to properly install/configure Maven
默认
。这是使用在节点上本地安装的版本的设置
Default
. This is the setting that uses the version that's installed locally on the node- 您必须转到Jenkins全局配置,并使用自动安装程序(从网络上)配置Maven版本。
- 在作业配置中,对于Maven版本,您必须选择 您刚刚配置的特定版本。
- You must go to Jenkins Global Configuration, and configure a Maven version with automatic installer (from the web).
- In Job configuration, for Maven Version, you must select that particular version that you've just configured.
这篇关于无法运行程序“mvn” error = 2,没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!