如何使用 groovy 脚本在 Jenkins 管道作业中调用 Ant? [英] How to invoke Ant in Jenkins pipeline job using groovy script?
本文介绍了如何使用 groovy 脚本在 Jenkins 管道作业中调用 Ant?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在将我的 Freestyle Jenkins 作业配置更改为 Pipeline.我需要调用 Ant 来执行 LogPublisherTask 和 ArtifactFilePublisherTask.它是如何使用 Groovy 脚本执行的?
I am changing my Freestyle Jenkins job configuration to Pipeline. I need to Invoke Ant to perform LogPublisherTask and ArtifactFilePublisherTask. How is it performed using Groovy scripting?
推荐答案
调用 ant 就像使用 maven 一样(查看示例 https://jenkins.io/doc/pipeline/jenkinsfile/):
You invoke ant just like you do it with maven (take a look at examples https://jenkins.io/doc/pipeline/jenkinsfile/):
node ('linux'){
stage 'Build and Test'
env.PATH = "${tool 'Ant'}/bin:${env.PATH}"
checkout scm
sh 'ant build'
}
任务本身应该在 build.xml
中配置.
The tasks themselves should be configured in the build.xml
.
这篇关于如何使用 groovy 脚本在 Jenkins 管道作业中调用 Ant?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文