An Ant plugin for Eclipse? Will wonders never cease.
When working with Ant, there are times when you need to know how your tasks are performing. To do this, you could open up the Ant console and see what’s going on but there’s a better way — use the Ant Plugin for Eclipse.
This blog post will cover the installation of the Ant Plugin for Eclipse.
Ant Plugin For Eclipse
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 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):
- Download and install the binary version of Ant from http://ant.apache.org .
- Click Run > External Tools > External Tools….
- Click Program
- Click New.
- Enter a name for your external tool (for example, External Ant).
- For the Location field, click Browse File System.
- Find and select a file called
ant.bat(it should be in the
binfolder of your Ant installation).
- In the Arguments field enter the arguments for your buildfile that would normally enter for running the buildfile outside of the Workbench.
- In the Working Directory field enter the directory of your buildfile.
- 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.
Running Ant buildfiles
Running external tools
Modifying the Ant classpath
Adding new Ant tasks and types