Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 792
Shruthi Avatar asked Jun 29 '16 15:06

Shruthi


Video Answer


1 Answers

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.

like image 138
Krzysztof Krasoń Avatar answered Oct 19 '22 23:10

Krzysztof Krasoń