本文介绍了使Jenkins奴隶识别Maven安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将Jenkins配置为在首次构建时自动在从站上安装maven.当我运行从"Maven Project"模板创建的作业时,此方法有效.我只需要指定目标即可,一切正常.

I have configured Jenkins to install maven automatically on slaves when building the first time. This works when I run jobs that were created off of "Maven Project" templates. I just have to specify the goals and everything works.

我遇到麻烦的是自由风格的软件项目.我如何告诉詹金斯将已安装的Maven的路径传递给这些工作?现在,我将在作业的build部分中添加maven路径.

It is with free-style software projects that I am having trouble with. How do I tell Jenkins to pass the path of installed maven to these jobs? For now, I am adding the maven path in the build section of the jobs.

我将Maven路径添加到从属服务器上的〜/.bashrc,〜/.bash_profile,但这也无济于事.

I added the maven path to ~/.bashrc, ~/.bash_profile on the slave, but that didn't help either.

推荐答案

只有在Build部分中定义Maven版本.它为您提供了为不同项目选择不同版本的灵活性.但是,如果仅安装了一个版本的Maven,则只需确保它存在于PATH变量中.要在任何Jenkins的从属服务器上设置相同的名称,只需转到该从属服务器的配置页面并将其添加到路径中即可.您可以参考以下屏幕截图以供参考:

It is in the Build section only that you define the Maven version. It provides you the flexibility to select different version for different projects. However, if you have only one version of Maven installed, then you simply have to make sure that it is present in the PATH variable. To set the same on any of the Jenkins' slave, just go to the slave's configuration page and add it in the path. You can refer the screenshot below for reference:

这篇关于使Jenkins奴隶识别Maven安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 09:03