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

邮差的信 提交于 2019-12-07 06:27:29

问题


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?


回答1:


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'
 }

The tasks themselves should be configured in the build.xml.



来源:https://stackoverflow.com/questions/38103958/how-to-invoke-ant-in-jenkins-pipeline-job-using-groovy-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!