Shruthi
Shruthi

Reputation: 71

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?

Upvotes: 5

Views: 14797

Answers (1)

Krzysztof Krasoń
Krzysztof Krasoń

Reputation: 27476

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.

Upvotes: 5

Related Questions