如何使用groovy脚本在Jenkins管道作业中调用Ant? [英] How to invoke Ant in Jenkins pipeline job using groovy script?

查看:227
本文介绍了如何使用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?

推荐答案

您像使用maven一样调用ant(请参阅示例< a href =https://jenkins.io/doc/pipeline/jenkinsfile/ =noreferrer> 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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆