简体   繁体   English

如何使用groovy脚本在Jenkins管道作业中调用Ant?

[英]How to invoke Ant in Jenkins pipeline job using groovy script?

I am changing my Freestyle Jenkins job configuration to Pipeline. 我正在将Freestyle Jenkins作业配置更改为Pipeline。 I need to Invoke Ant to perform LogPublisherTask and ArtifactFilePublisherTask. 我需要调用Ant来执行LogPublisherTask和ArtifactFilePublisherTask。 How is it performed using Groovy scripting? 使用Groovy脚本如何执行?

You invoke ant just like you do it with maven (take a look at examples https://jenkins.io/doc/pipeline/jenkinsfile/ ): 您可以像使用maven一样调用ant(请看示例https://jenkins.io/doc/pipeline/jenkinsfile/ ):

 node ('linux'){
  stage 'Build and Test'
  env.PATH = "${tool 'Ant'}/bin:${env.PATH}"
  checkout scm
  sh 'ant build'
 }

The tasks themselves should be configured in the build.xml . 任务本身应在build.xml进行配置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM