无法运行程序“ MVN”错误= 2,没有这样的文件或目录

我在Ubuntu 14.04 LTS上进行构建,但得到以下信息:

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的创建,而没有我可能没有的正确权限。这是问题吗,我该如何解决?

回答:

这里有很多事情。

您或者没有在Job配置中选择Maven版本。或者您没有配置Jenkins安装Maven版本。或者您希望在从站上使用本地安装的Maven,但未为jenkins用户配置它。

由于我不知道您已配置(或未配置)什么以及您预期使用什么,因此我无法直接回答,但是我可以解释它是如何工作的。

回答:

  • 您必须在本地安装Maven
  • 您必须能够与jenkins用户 启动它

    1. 执行sudo jenkins,然后mvn在从站上执行以验证jenkins用户可以运行mvn
    2. 如果失败,则需要正确安装/配置Maven

  • 在作业配置中,对于Maven版本, 选择Default。此设置使用节点上本地安装的版本

回答:

  • 您必须转到Jenkins全局工具配置,并使用自动安装程序(从Web)配置Maven版本。
  • 在作业配置,Maven的版本,你必须选择 特定的版本,您刚刚配置。

以上是 无法运行程序“ MVN”错误= 2,没有这样的文件或目录 的全部内容, 来源链接: utcz.com/qa/416703.html

回到顶部