jenkins build 报错: mvn: command not found 解决

Posted hepeng

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jenkins build 报错: mvn: command not found 解决相关的知识,希望对你有一定的参考价值。

jenkins build 报错:

[hello-world-freestyle] $ /bin/sh -xe /root/softs/apache-tomcat-9.0.35/temp/jenkins5323864766359302328.sh
+ mvn clean package
/root/softs/apache-tomcat-9.0.35/temp/jenkins5323864766359302328.sh: line 2: mvn: command not found
Build step ‘Execute shell‘ marked build as failure
Finished: FAILURE

1、查询系统环境变量: echo $PATH

  [root@VM_0_8_centos ~]# echo $PATH
  /root/jenkins_home/downloads/apache-maven-3.6.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

 2. 在jenkins中设置环境变量:

  【系统管理】->【系统设置】->【全局属性】->【环境变量】

技术图片

 

以上是关于jenkins build 报错: mvn: command not found 解决的主要内容,如果未能解决你的问题,请参考以下文章

jenkins执行mvn -f ${project_name} clean package报错:找不到父工程

Jenkins Maven Build Step失败但从命令行运行

mvn 编译报错mavn sun.security.validator.ValidatorException: PKIX path building failed: sun.security.prov

jenkins 调用 脚本命令 svn co 报错

jenkins构建java项目找不到命令mvn,java的解决方法

命令行运行mvn test后报错[ERROR] Error executing Maven. [ERROR] 1 problem was encountered while building the