Using the Ant view

Eclipse provides a standard view, the Ant view, that lets you work with your Ant buildfiles. This view is tree-structured, showing Ant buildfiles as top-level entries and targets & subtargets as children. The main advantage of this view is that you can work with all of your Ant buildfiles in one place, as opposed to hunting them down in the Navigator.

  1. Open the Ant view from the workbench menu by selecting Window > Show View > Other... > Ant > Ant.
  2. By default, the Ant view is empty. There are two ways to add Ant buildfiles to this view:
  3. Once added to the Ant view, Ant buildfile entries remain in the view across workbench invocations until explicitly removed.
  4. Click the Add Buildfiles with Search button. Suppose you only remember that the buildfile you want to work with starts with 'H'. Enter 'H*.xml' for the buildfile name. Make sure Workspace is selected for the scope, then click Search. The HelloWorld.xml file is found and placed in the Ant view.
  5. Expand the top-level entry to see the default target Hello, and the subtarget World.
    Ant view
  6. Select the World subtarget and click the Play button. Notice that just the World subtarget gets executed.
  7. Select the top-level HelloWorld buildfile and click Play. Notice that just the default target, Hello, gets executed.
  8. To edit your buildfile, bring up the context menu on the HelloWorld file and select Open With > Ant Editor.
  9. To edit the default launch configuration, select Properties... from the context menu.
  10. The Run Ant dialog appears. Here you can modify the way in which the buildfile is run from the Ant view. Note that the choice and order of targets is ignored when running from the Ant view. If the top-level file is selected, just the default target is run and if one of the targets or subtargets is selected, just that target is run. It is not possible to run multiple targets from the Ant view.
  11. Select the HelloWorld file, then click the Remove button. The buildfile is removed from the view. Note that this does not delete the file from the workspace.


Copyright IBM Corporation 2000, 2003. All Rights Reserved.