java – 无法运行程序“mvn”error = 2,没有这样的文件或目录

前端之家收集整理的这篇文章主要介绍了java – 无法运行程序“mvn”error = 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

签出修订版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的创建没有正确的权限
我可能没有这是问题,我该如何解决

解决方法

这里有很多东西.

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

由于我不知道你配置了什么(或没有配置)以及你期望使用什么,我无法直接回答,但我可以解释它是如何工作的.

如果要在主/从机上使用本地安装的Maven

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

>执行sudo jenkins,然后在你的Slave上执行mvn来验证jenkins用户是否可以运行mvn
>如果失败,您需要正确安装/配置Maven

>在作业配置中,对于Maven版本,您必须选择“默认”.这是使用本地安装在节点上的版本的设置

如果你想让Jenkins为你安装Maven

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

原文链接:/java/121754.html

猜你在找的Java相关文章