org.apache.tools.ant.module/3 3.47.1 2

org.apache.tools.ant.module.api.support
Class TargetLister

java.lang.Object
  extended by org.apache.tools.ant.module.api.support.TargetLister

public class TargetLister
extends Object

Provides a way to find targets from an Ant build script.

Note that scripts may import other scripts using the <import> pseudotask, so you may need to use TargetLister.Target.getScript() to check which script a target came from.

Warning: the implementation attempts to handle import statements which use Ant properties in the imported file name, but it is not possible to determine what the value of the file path will actually be at runtime with complete accuracy. If the import location cannot be resolved, an IOException may be thrown or that import may simply be skipped.

The imported file path is considered relative to the project base directory, hopefully according to Ant's own rules.

If an import statement is marked as optional, and the imported script cannot be found, it will be silently skipped (as Ant does). If it is marked as mandatory (the default), this situation will result in an IOException.

Since:
org.apache.tools.ant.module/3 3.11

Nested Class Summary
static class TargetLister.Target
          Representation of a target from an Ant script.
 
Method Summary
static Set<TargetLister.Target> getTargets(AntProjectCookie script)
          Gets all targets in an Ant script.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getTargets

public static Set<TargetLister.Target> getTargets(AntProjectCookie script)
                                           throws IOException
Gets all targets in an Ant script. Some may come from imported scripts. There is no guarantee that the actual TargetLister.Target objects will be the same from call to call.

Parameters:
script - an Ant build script
Returns:
an immutable, unchanging set of TargetLister.Targets; may be empty
Throws:
IOException - in case there is a problem reading the script (or a subscript)

org.apache.tools.ant.module/3 3.47.1 2

Built on December 5 2011.  |  Portions Copyright 1997-2011 Sun Microsystems, Inc. All rights reserved.