Using a different version of Ant

The Eclipse platform provides a recent stable version of Ant as a plug-in library. The installed version of the org.apache.ant plug-in can be found in Help > About Eclipse > Installation Details > Plugins. It is possible to use a different version of Ant, but other versions are not supported or guaranteed to work correctly.

There are at least two different ways to use an alternate version of Ant in Eclipse:

Changing the Ant runtime classpath:
When Ant runs a buildfile, it looks for the necessary classes on the Ant classpath. The Ant classpath consists of the plug-ins contributing new tasks, types or libraries, plus the classpath defined in the Ant runtime classpath preferences. To access the preferences, click command link Window > Preferences > Ant > Runtime. The JARs related to Ant 1.7.1 are grouped under the Ant Home Entries item. To change the Ant Home entries, click on the Ant Home... button and choose the Ant installation you wish to use.

After you change the Ant classpath, all future Ant builds will use the updated version instead of the default. To restore the Ant classpath to its original state, Restore Defaults button on the preference page.

Using Ant as an external tool:
When changing the Ant classpath is not an option, or if you just want to test a newer or beta version of Ant, using it as an external tool is an option. Usually when it is running in the Workbench, the Ant buildfile itself is considered to be a external tool, but this is not the only way. To install a binary distribution of Ant as an external tool (Note: These steps are for Windows, but similar methods can be used for other operating systems):
  1. Download and install the binary version of Ant from http://ant.apache.org .
  2. Click command link Run > External Tools > External Tools....
  3. Click Program
  4. Click New.
  5. Enter a name for your external tool (for example, External Ant).
  6. For the Location field, click Browse File System.
  7. Find and select a file called ant.bat (it should be in the bin folder of your Ant installation).
  8. In the Arguments field enter the arguments for your buildfile that would normally enter for running the buildfile outside of the Workbench.
  9. In the Working Directory field enter the directory of your buildfile.
  10. Click Run to execute the buildfile.

When you run Ant as an external tool, none of the tasks or types contributed by Eclipse will work. Also, the Ant classpath preference has no effect in the buildfile execution.

Related concepts
Ant Support
External tools

Related tasks
Running Ant buildfiles
Running external tools
Modifying the Ant classpath
Adding new Ant tasks and types