简体   繁体   English

无法在詹金斯配置Maven

[英]Unable to configure Maven in Jenkins

Maven version 3.3.3 (Maven is configured in my system. I'm able to get version number by mvn -version .) Maven版本3.3.3(在系统中配置了Maven。我可以通过mvn -version获取版本号。)

Following is my Maven project in Jenkins: 以下是我在詹金斯(Jenkins)的Maven项目:

在此处输入图片说明

Which basically asks me to configure Maven. 这基本上是要求我配置Maven。

Below are the only fields available when I select Configure System . 当我选择Configure System时,以下是唯一可用的字段。 Though I gave the path of Maven, the error is not removed and unable to build. 尽管我给出了Maven的路径,但错误并没有消除并且无法生成。

在此处输入图片说明

Can someone help on this. 有人可以帮忙吗?

Please check "Jenkins => Configuration => Global Tool Configuration". 请检查“ Jenkins =>配置=>全局工具配置”。 There you can define your maven-installation not only the the environment-variable MAVEN_HOME. 在这里,您不仅可以定义环境变量MAVEN_HOME,还可以定义maven安装。

Afterwards you should be able to select your maven-installation in your project-build. 之后,您应该能够在项目构建中选择maven安装。

First you should configure a JDK and NOT an JRE. 首先,您应该配置一个JDK而不是一个JRE。 Furthermore the rootPOM location is relative to the Jenkins Job Workspace which means usually only pom.xml nothing more... 此外, rootPOM位置是相对于Jenkins Job Workspace的,这意味着通常仅pom.xml仅此而已...

ln -s /opt/apache-maven-3.5.4/bin/mvn /usr/bin/mvn ln -s /opt/apache-maven-3.5.4/bin/mvn /usr/bin/mvn

run echo $PATH in pipeline script and see paths available to Jenkins user. 在管道脚本中运行echo $PATH并查看Jenkins用户可用的路径。 Once linking with maven bin path, maven started working. 与maven bin路径链接后,maven开始工作。 To check, run mvn -v in the pipeline. 要进行检查,请在管道中运行mvn -v

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM