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 you mistakenly attempt to run a non-Ant .xml file as an Ant buildfile.

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

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

    Run Ant dialog

  3. This dialog allows you to configure many aspects of the way your Ant buildfile is run, but for now we will concentrate on the Targets tab which allows you to select the 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.

But what if you sometimes want to run the buildfile so the Hello target executed first, and other times so the World target was first? Would you have to bring up the dialog each time and change the ordering? Fortunately, as we'll see in the next section, the answer is no.


Copyright IBM Corporation 2000, 2003. All Rights Reserved.