Running Ant buildfiles

Any file with a .xml extension can be run as an Ant buildfile. Of course, not all such files really are Ant buildfiles, but no harm is done if an attempt is made to mistakenly run a non-Ant .xml file as an Ant buildfile.

In this section, the basic mechanisms for running Ant buildfiles in Eclipse will be covered, using the HelloWorld.xml file created in the last section.

  1. Select HelloWorld.xml in the Navigator and choose Run > External Tools from its context menu.
  2. The External Tools dialog appears.

    Run Ant dialog

  3. This dialog allows the configuration of the many aspects of the way an Ant buildfile is run, but for now concentrate on the Targets tab which allows the selection of which Ant targets to run and their order. Select both targets and leave the order as the default.
  4. Click Run.
  5. The Ant buildfile is run, and the output is sent to the Console view.

Fortunately, if the buildfile is run so that the Hello target is executed first and other times so that the World target is first, the dialog does not need to be brought up each time nor does the ordering need to be changed.

Legal notices