public final class AntTargetExecutor extends Object
Modifier and Type | Class and Description |
---|---|
static class |
AntTargetExecutor.Env
Class describing the environment in which the Ant target will be executed.
|
Modifier and Type | Method and Description |
---|---|
static AntTargetExecutor |
createTargetExecutor(AntTargetExecutor.Env env)
Factory method for creation of AntTargetExecutor with the given environment.
|
ExecutorTask |
execute(AntProjectCookie antProject,
String[] targets)
Execute given target(s).
|
public static AntTargetExecutor createTargetExecutor(AntTargetExecutor.Env env)
env
- a configuration for the executorpublic ExecutorTask execute(AntProjectCookie antProject, String[] targets) throws IOException
The AntProjectCookie.getFile()
must not be null, since Ant can only
run files present on disk.
The returned task may be used to wait for completion of the script and check result status.
The easiest way to get the project cookie is to get a DataObject
representing an Ant build script and to ask it for this cookie. Alternatively,
you may implement the cookie interface directly, where
getFile
is critical and other methods may do nothing
(returning null
as needed).
While the specification for AntProjectCookie
says that
getDocument
and getParseException
cannot
both return null
simultaneously, the current
executor implementation does not care; to be safe, return an
UnsupportedOperationException
from getParseException
.
antProject
- a representation of the project to runtargets
- non-empty list of target names to run; may be null to indicate default targetIOException
- if there is a problem running the script