I have created a Jenkins Pipeline job. In this job I want to do the build using Ant. I have configured the Ant variable in Manage **Jenkins > Global Tool Configuration**
as Ant1.9.1= D:\path_to_hybris\hybris\bin\platform\apache-ant-1.9.1
.
In a freestyle jenkins Job, I know that the build.xml location can be specified as in the below screenshot:
but I am unable to understand how to specify the ant groovy script beyond this point, especially where can we mention the path to build.xml file:
def antHome = tool 'Ant1.9.1'
????
????
you can use ant wrapper in Jenkins`s pipeline groovy script. Remember to configure the ant tool in the Jenkins "Global Tool Configuration" with the same name "LocalAnt". for the sh "ant build" do I need to put the path to the build xml file or will simply typing `"ant build" work?
Just select install automatically and choose the appropriate Add Installer option whether you want to extract from zip or install from Apache. Now, Ant is integrated with Jenkins. You can use Ant in the build process. While configuring a job, in the build option select invoke Ant and choose the Ant version.
Learn how to automate Jenkins continuous integration projects with Apache Ant, a popular build tool for developing software. Jenkins integrates with multiple build tools such as Maven, Gradle, and Ant.
you can use ant wrapper in Jenkins`s pipeline groovy script.
withAnt(installation: 'LocalAnt') {
// some block
sh "ant build"
//for windows
bat "ant build"
}
Remember to configure the ant tool in the Jenkins "Global Tool Configuration" with the same name "LocalAnt".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With