public class AntBuilder
extends BuilderSupport
Allows Ant tasks to
be used with a Groovy builder-style markup. Requires that ant.jar is on your classpath which will
happen automatically if you are using the Groovy distribution but will be up
to you to organize if you are embedding Groovy. If you wish to use the
optional tasks
you will need to add one or more additional jars from the ant distribution to
your classpath - see the library
dependencies for more details.
| Constructor and description |
|---|
AntBuilder()Creates an AntBuilder backed by a freshly initialized Ant project. |
AntBuilder(Project project)Creates an AntBuilder backed by the supplied project. |
AntBuilder(Project project, Target owningTarget)Creates an AntBuilder backed by the supplied project and owning target. |
AntBuilder(Task parentTask)Creates an AntBuilder that shares the context of the supplied parent task. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
protected static Attributes |
buildAttributes(Map attributes)Builds an Attributes from a Map |
|
protected Object |
createNode(Object tagName)Creates a node with no attributes or body text. |
|
protected Object |
createNode(Object name, Object value)Creates a node and applies inline text to it. |
|
protected Object |
createNode(Object name, Map attributes, Object value)Creates a node, applies attributes, and then applies inline text to it. |
|
protected Object |
createNode(Object name, Map attributes)Creates a node from the supplied name and attributes. |
|
protected static Project |
createProject()
|
|
protected Object |
doInvokeMethod(String methodName, Object name, Object args)We don't want to return the node as created in createNode(Object, Map, Object) but the one made ready by nodeCompleted(Object, Object) |
|
public Project |
getAntProject()Returns the underlying Ant project instance. |
|
public AntXMLContext |
getAntXmlContext()Gets the xml context of Ant used while creating tasks |
|
public Project |
getProject()# Gets the Ant project in which the tasks are executed |
|
public boolean |
isSaveStreams()Whether stdin, stdout, stderr streams are saved. |
|
protected void |
nodeCompleted(Object parent, Object node)Determines, when the ANT Task that is represented by the "node" should perform. |
|
protected void |
setParent(Object parent, Object child)Ant child nodes are attached by Ant's own configuration machinery, so this hook is intentionally a no-op. |
|
public void |
setSaveStreams(boolean saveStreams)Indicates that we save stdin, stdout, stderr and replace them while AntBuilder is executing tasks with streams that funnel the normal streams into Ant's logs. |
|
protected void |
setText(Object task, String text)Applies nested text content to the current Ant task. |
| Methods inherited from class | Name |
|---|---|
class BuilderSupport |
createNode, createNode, createNode, createNode, doInvokeMethod, getCurrent, getName, invokeMethod, invokeMethod, nodeCompleted, postNodeCompletion, setClosureDelegate, setCurrent, setParent |
class GroovyObjectSupport |
getMetaClass, setMetaClass |
Creates an AntBuilder backed by a freshly initialized Ant project.
Creates an AntBuilder backed by the supplied project.
project - the project used to create and execute Ant tasks Creates an AntBuilder backed by the supplied project and owning target.
project - the project used to create and execute Ant tasksowningTarget - the target that should collect top-level tasks Creates an AntBuilder that shares the context of the supplied parent task.
parentTask - the Ant task whose project and owning target should be reusedBuilds an Attributes from a Map
attributes - the attributes to wrapCreates a node with no attributes or body text.
tagName - the requested node nameCreates a node and applies inline text to it.
name - the requested node namevalue - the inline text valueCreates a node, applies attributes, and then applies inline text to it.
name - the requested node nameattributes - the node attributesvalue - the inline text valueCreates a node from the supplied name and attributes.
name - the requested node nameattributes - the attributes to apply
We don't want to return the node as created in createNode(Object, Map, Object) but the one made ready by nodeCompleted(Object, Object)
Returns the underlying Ant project instance.
Gets the xml context of Ant used while creating tasks
# Gets the Ant project in which the tasks are executed
Whether stdin, stdout, stderr streams are saved.
Determines, when the ANT Task that is represented by the "node" should perform. Node must be an ANT Task or no "perform" is called. If node is an ANT Task, it performs right after complete construction. If node is nested in a TaskContainer, calling "perform" is delegated to that TaskContainer.
parent - note: null when node is rootnode - the node that now has all its children appliedAnt child nodes are attached by Ant's own configuration machinery, so this hook is intentionally a no-op.
parent - the logical parent nodechild - the logical child nodeIndicates that we save stdin, stdout, stderr and replace them while AntBuilder is executing tasks with streams that funnel the normal streams into Ant's logs.
saveStreams - set to false to disable this behaviorCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.