Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Apache Ant (formerly Jakarta Ant) is a declarative, XML-based build tool for Java projects. It provides a rich set of standard tasks for performing most common build operations, such as compilation with javac, building archives and running tests. Ant's functionality can be extended through custom tasks and macros.


Apache Ant is a Java open-source library and command-line tool whose mission is to drive processes described in XML build files as targets and extension points dependent upon each other. The main known usage of Ant is the build of Java applications.

Ant supplies a number of built-in tasks allowing to compile, assemble, test and run applications. Although primarily aimed at building Java applications, Ant can also be used effectively to build non-Java software, for instance C or C++ applications. More generally, Ant can be used to pilot any type of process which can be described in terms of targets, tasks, and macros. It's a standard and effective framework which transforms a development structure of project to deployment structure.

Ant was historically meant as a replacement and Java counterpart for the UNIX Make build utility.




Hello World

A build.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<project name="HelloWorld" default="world" basedir=".">
  <target name="world" depends="message" description="outputs a friendly message">
    <echo message="World!" />
  <target name="message">
    <echo message="Hello, " />

This project can be run from the directory containing the build.xml file by just typing:

  • ant
  • or ant -f build.xml

The list of available self-documenting targets can be viewed with ant -p.

history | excerpt history