gpt4 book ai didi

jenkins - 如何在 Jenkins Groovy 管道中调用 Ant

转载 作者:行者123 更新时间:2023-12-04 06:41:03 25 4
gpt4 key购买 nike

我创建了一个 Jenkins Pipeline 作业。在这份工作中,我想使用 Ant 进行构建。我已经在管理中配置了 Ant 变量 **Jenkins > Global Tool Configuration**Ant1.9.1= D:\path_to_hybris\hybris\bin\platform\apache-ant-1.9.1 .

在自由式 jenkins 工作中,我知道可以指定 build.xml 位置,如下面的截图所示:enter image description here

但我无法理解如何在这一点之外指定 ant groovy 脚本,尤其是我们在哪里可以提到 build.xml 文件的路径:

def antHome = tool 'Ant1.9.1'
????
????

最佳答案

您可以在 Jenkins 的管道 groovy 脚本中使用 ant 包装器。

withAnt(installation: 'LocalAnt') {
// some block
sh "ant build"
//for windows
bat "ant build"
}

记得在Jenkins“全局工具配置”中配置ant工具同名“LocalAnt”。

关于jenkins - 如何在 Jenkins Groovy 管道中调用 Ant,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41384971/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com