ANT Introduction


Why do you need a build tool?

Before diving deep into the definition of Apache Ant, one must understand the need for a build tool. Why do I need Ant, or more specifically, why do I need a build tool?

Do you spend your day doing the following manually?

  • Compile code

  • Package the binaries

  • Deploy the binaries to the test server

  • Test your changes

  • Copy code from one location to another

If you have answered yes to any of the above, then it is time to automate the process and take away that burden from you.

On average, a developer spends 3 hours (out of a 8 hour working day) doing mundane tasks like build and deployment. Wouldn't you be delighted to get back the 3 hours?

Enter Apache Ant. Apache Ant is an operating system build and deployment tool that can be executed from a command line.

History of Apache Ant

  • Ant stands for Another Neat Tool

  • Ant was created by James Duncan Davidson (the original author of Tomcat), while flying from Europe to USA

  • Ant was originally used to build Tomcat, and was bundled as part of Tomcat distribution

  • Ant was born out of the problems and complexity associated with the make tool

  • Ant was promoted as an independent project in Apache in 2000

  • The current version of Apache Ant (as of July 2011) is 1.8.2

  • NAnt is a .NET build tool that is similar to Ant, but is used to build .NET apps

Features of Apache Ant

  • Ant is the most complete Java build and deployment tool available.

  • Ant is platform neutral and can handle platform specific properties such as file separators.

  • Ant can be used to perform platform specific tasks such as modifying the modified time of a file using 'touch' command.

  • Ant scripts are written using plain XML. If you are already familiar with XML, you can learn Ant pretty quickly.

  • Ant is good at automating complicated repetitive tasks.

  • Ant comes with a big list of predefined tasks.

  • Ant provides an interface to develop custom tasks.

  • Ant can be easily invoked from the command line and it can integrate with free and commercial IDEs.