[英]Jenkins job with different maven versions
I have a maven Jenkins job, that is part of a multijob. 我有一个行家詹金斯(Jenkins)工作,这是多工的一部分。 Τhis used to run always on windows nodes, but currently we have created some linux nodes, too, that we want to utilize.
他曾经总是在Windows节点上运行,但是目前我们也创建了一些Linux节点,希望使用。 The thing is that inside the job,at build step you have to choose:
问题是在工作内部,在构建步骤中您必须选择:
This maven version applies when building the job. 该Maven版本在构建作业时适用。 For example the maven version that applied here,, is linked to the path were maven is installed for windows.
例如,此处应用的maven版本链接到为Windows安装了maven的路径。 So this path, is applicable only for windows nodes, therefore, the job cannot be run by a linux node.
因此,此路径仅适用于Windows节点,因此,该作业无法由linux节点运行。 Is there a workaround for this?
有没有解决方法? thanks!
谢谢!
You can achieve it using Jenkins pipeline. 您可以使用Jenkins管道来实现。 Just set two maven config in Jenkins > global tool configuration.
只需在Jenkins>全局工具配置中设置两个Maven配置。 One for windows maven and other for linux.
一个用于Windows Maven,另一个用于Linux。
node {
def mvnHome
stage('Build') {
// Run the maven build
if (isUnix()) {
mvnHome = tool 'Maven-linux'
sh "'${mvnHome}/bin/mvn' clean package "
} else {
mvnHome = tool 'Maven-windows'
bat(/"${mvnHome}\bin\mvn" clean package /)
}
}
Another way to do it is to use Jenkins Conditional build step plugin . 另一种方法是使用Jenkins 条件构建步骤插件 。
Configure your linux slaves: 配置您的Linux从站:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.