Apache Ant – Get the current running Ant version in Ant script

I am trying to figure out which Apache Ant version is running on the Jenkins server. Starting from Apache Ant 1.7.0, you can make use of the <Antversion> task to determine the running Ant version. The following is a simple build.xml which could serve this purpose.

<project name="ant-antversion-example" default="run" basedir=".">
  <target name="run">
    <echo message="Checking ANT version ..."/>
    <antversion property="antversion"/>
    <echo message="  version: ${antversion}"/>
  </target>
</project>

 

Try it out.
apache-ant-get-runnint-ant-version
 

Done =)

Reference Apache Ant – <Antversion>

Advertisement

One thought on “Apache Ant – Get the current running Ant version in Ant script”

  1. I am using Ant as a build tool for my selenium scripts .
    I have multiple .properties file (eg. like qa.properties / prod.properties / perf.properties).I want to pass the parameters from each of the .properties file to ANT .how do i do it ?Please help

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.