Gitlab CI/CD运行器:找不到mvn命令 [英] Gitlab CI/CD runner : mvn command not found

查看:1565
本文介绍了Gitlab CI/CD运行器:找不到mvn命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Maven 已很好地安装在我的 gitlab-runner 服务器上.当直接在我的仓库上执行mvn clean时,它可以工作,当使用Gitlab UI运行管道时出现此错误:

Maven is well installed on my gitlab-runner server. When executing mvn clean directly on my repo it works, when running my pipeline using Gitlab UI got this error :

bash:第60行:mvn:找不到命令

bash: line 60: mvn: command not found

错误:作业失败:退出状态1

ERROR: Job failed: exit status 1

我注意到我试图通过在 .gitlab-ci.yml 文件中添加before_script部分来解决此问题:

I notice that I tried to fix the problem by adding the before_script section in the .gitlab-ci.yml file :

before_script:    
- export MAVEN_HOME=/usr/local/apache-maven

我还添加了一行:

environment = ["MAVEN_HOME=/usr/local/apache-maven"]

config.toml 文件中.

问题仍然存在,我的执行者是: shell .

the problem still persist, my executor is : shell.

任何建议!

推荐答案

我设法使用以下解决方法解决了该问题:

I managed to fix the problem using this workaround:

  script:
    - $MAVEN_HOME/bin/mvn clean

这篇关于Gitlab CI/CD运行器:找不到mvn命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆