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

 手机用户2502938867 发布于 2022-12-11 19:22

我正在使用我的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.(Proc.java:244)
    at hudson.Proc$LocalProc.(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.(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而没有我可能没有的正确权限.这是问题,我该如何解决?

2 个回答
  • 如果您只是寻找最简单的解决方案,那么您应该去全球jenkins配置

    http://localhost:32773/configureTools/
    

    并配置maven这样的

    在此输入图像描述

    然后你必须去你的项目.您已构建内部设置.选择你一分钟前创建的maven.

    在此输入图像描述

    2022-12-11 19:24 回答
  • 这里有很多东西.

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

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

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

    您必须在本地安装Maven

    您必须能够与jenkins用户一起启动它

      执行sudo jenkins,然后mvn在Slave上执行以验证jenkins用户是否可以运行mvn

      如果失败,则需要正确安装/配置Maven

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

    如果你想让Jenkins为你安装Maven

    您必须转到Jenkins全局配置,并使用自动安装程序(从Web)配置Maven版本.

    在作业配置,Maven的版本,你必须选择你刚刚配置的特定版本.

    2022-12-11 19:24 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有