如何在Jenkins Groovy管道中调用Ant [英] How to invoke Ant in a Jenkins Groovy Pipeline
问题描述
我创建了Jenkins Pipeline作业.在这项工作中,我想使用Ant进行构建.我已经在Manage **Jenkins > Global Tool Configuration**
中将Ant变量配置为Ant1.9.1= D:\path_to_hybris\hybris\bin\platform\apache-ant-1.9.1
.
I have created a Jenkins Pipeline job. In this job I want to do the build using Ant. I have configured the Ant variable in Manage **Jenkins > Global Tool Configuration**
as Ant1.9.1= D:\path_to_hybris\hybris\bin\platform\apache-ant-1.9.1
.
在自由式詹金斯(Jenkins)作业中,我知道可以按照以下屏幕快照中的说明指定build.xml位置:
In a freestyle jenkins Job, I know that the build.xml location can be specified as in the below screenshot:
但是我无法理解如何在此之后指定ant groovy脚本,尤其是在哪里可以提及build.xml文件的路径:
but I am unable to understand how to specify the ant groovy script beyond this point, especially where can we mention the path to build.xml file:
def antHome = tool 'Ant1.9.1'
????
????
推荐答案
您可以在Jenkins的管道常规脚本中使用蚂蚁包装器.
you can use ant wrapper in Jenkins`s pipeline groovy script.
withAnt(installation: 'LocalAnt') {
// some block
sh "ant build"
//for windows
bat "ant build"
}
请记住在Jenkins全局工具配置"中以相同的名称"LocalAnt"来配置蚂蚁工具.
Remember to configure the ant tool in the Jenkins "Global Tool Configuration" with the same name "LocalAnt".
这篇关于如何在Jenkins Groovy管道中调用Ant的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!