|
Eclipse Platform Release 3.3 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.ant.core.AntRunner
Entry point for running Ant builds inside Eclipse (within the same JRE). Clients may instantiate this class; it is not intended to be subclassed.
addBuildListener
,
addBuildLogger
and setInputHandler
methods to configure classes that will be invoked during the
build. When using these methods, it is necessary to package
the classes in a jar that is not on the client plugin's classpath.
The jar must be added to the Ant classpath. One way to add
the jar to the Ant classpath is to use the
org.eclipse.ant.core.extraClasspathEntries
extension.
Refer to the "Platform Ant Support" chapter of the Programmer's Guide section in the Platform Plug-in Developer Guide for complete details.
Field Summary | |
---|---|
protected String |
antHome
|
protected String[] |
arguments
|
protected String |
buildFileLocation
|
protected List |
buildListeners
|
protected String |
buildLoggerClassName
|
protected URL[] |
customClasspath
|
protected String |
inputHandlerClassName
|
protected int |
messageOutputLevel
|
protected String[] |
propertyFiles
|
protected String[] |
targets
|
protected Map |
userProperties
|
Fields inherited from interface org.eclipse.equinox.app.IApplication |
---|
EXIT_OK, EXIT_RELAUNCH, EXIT_RESTART |
Constructor Summary | |
---|---|
AntRunner()
|
Method Summary | |
---|---|
void |
addBuildListener(String className)
Adds a build listener. |
void |
addBuildLogger(String className)
Sets the build logger. |
void |
addUserProperties(Map properties)
Adds user-defined properties. |
TargetInfo[] |
getAvailableTargets()
Returns the buildfile target information. |
protected void |
handleInvocationTargetException(Object runner,
Class classInternalAntRunner,
InvocationTargetException e)
|
static boolean |
isBuildRunning()
Returns whether an Ant build is already in progress Only one Ant build can occur at any given time. |
protected void |
problemLoadingClass(Throwable e)
|
void |
run()
Runs the build file. |
void |
run(IProgressMonitor monitor)
Runs the build file. |
Object |
run(Object argArray)
Invokes the building of a project object and executes a build using either a given target or the default target. |
void |
setAntHome(String antHome)
Sets the Ant home to use for this build |
void |
setArguments(String arguments)
Sets the arguments to be passed to the build (e.g. |
void |
setArguments(String[] arguments)
Sets the arguments to be passed to the build (e.g. |
void |
setBuildFileLocation(String buildFileLocation)
Sets the build file location on the file system. |
void |
setCustomClasspath(URL[] customClasspath)
Sets the custom classpath to use for this build |
void |
setExecutionTargets(String[] executionTargets)
Sets the targets and execution order. |
void |
setInputHandler(String className)
Sets the input handler. |
void |
setMessageOutputLevel(int level)
Set the message output level. |
void |
setPropertyFiles(String[] propertyFiles)
Sets the user specified property files. |
Object |
start(IApplicationContext context)
Invokes the building of a project object and executes a build using either a given target or the default target. |
void |
stop()
Forces this running application to exit. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected String buildFileLocation
protected List buildListeners
protected String[] targets
protected Map userProperties
protected int messageOutputLevel
protected String buildLoggerClassName
protected String inputHandlerClassName
protected String[] arguments
protected String[] propertyFiles
protected URL[] customClasspath
protected String antHome
Constructor Detail |
public AntRunner()
Method Detail |
public void setBuildFileLocation(String buildFileLocation)
buildFileLocation
- the file system location of the build filepublic void setMessageOutputLevel(int level)
Valid values are:
org.apache.tools.ant.Project.ERR
,
org.apache.tools.ant.Project.WARN
,
org.apache.tools.ant.Project.INFO
,
org.apache.tools.ant.Project.VERBOSE
or
org.apache.tools.ant.Project.DEBUG
level
- the message output levelpublic void setArguments(String arguments)
arguments
- the arguments to be passed to the buildpublic void setArguments(String[] arguments)
arguments
- the arguments to be passed to the buildpublic void setExecutionTargets(String[] executionTargets)
executionTargets
- which targets should be run and in which orderpublic void addBuildListener(String className)
className
is the class name of an org.apache.tools.ant.BuildListener
implementation. The class will be instantiated at runtime and the
listener will be called on build events
(org.apache.tools.ant.BuildEvent
).
Refer to Usage Note
for implementation details.
className
- a build listener class namepublic void addBuildLogger(String className)
className
is the class name of an org.apache.tools.ant.BuildLogger
implementation. The class will be instantiated at runtime and the
logger will be called on build events
(org.apache.tools.ant.BuildEvent
).
Only one build logger is permitted for any build.
Refer to Usage Note
for implementation details.
className
- a build logger class namepublic void addUserProperties(Map properties)
properties
- a Map of user-defined propertiespublic TargetInfo[] getAvailableTargets() throws CoreException
CoreException
- Thrown if problem is encountered determining the targetsTargetInfo
public void run(IProgressMonitor monitor) throws CoreException
org.apache.tools.ant.Project.getReferences()
). A long-
running task could, for example, get the monitor during its execution and
check for cancellation. The key value to retrieve the progress monitor
instance is AntCorePlugin.ECLIPSE_PROGRESS_MONITOR
.
Only one build can occur at any given time.
Sets the current threads context class loader to the AntClassLoader
for the duration of the build.
monitor
- a progress monitor, or null
if progress
reporting and cancellation are not desired
CoreException
- Thrown if a build is already occurring or if an exception occurs during the buildprotected void handleInvocationTargetException(Object runner, Class classInternalAntRunner, InvocationTargetException e) throws CoreException
CoreException
protected void problemLoadingClass(Throwable e) throws CoreException
CoreException
public void run() throws CoreException
CoreException
- Thrown if a build is already occurring or if an exception occurs during the buildpublic Object run(Object argArray) throws Exception
org.eclipse.ant.core.antRunner
as the application.
Sets the current threads context class loader to the AntClassLoader
for the duration of the build.
argArray
- the command line arguments
EXIT_OK
) indicating normal termination if no exception occurs
Exception
- if a problem occurred during the buildfile executionpublic void setInputHandler(String className)
className
is the class name of an org.apache.tools.ant.input.InputHandler
implementation. The class will be instantiated at runtime and the
input handler will be used to respond to <input> requests
Only one input handler is permitted for any build.
Refer to Usage Note
for implementation details.
className
- an input handler class namepublic void setPropertyFiles(String[] propertyFiles)
propertyFiles
- array of property file pathspublic void setCustomClasspath(URL[] customClasspath)
customClasspath
- array of URLs that define the custom classpathpublic void setAntHome(String antHome)
antHome
- String specifying the Ant home to usepublic static boolean isBuildRunning()
public Object start(IApplicationContext context) throws Exception
org.eclipse.ant.core.antRunner
as the application.
Sets the current threads context class loader to the AntClassLoader
for the duration of the build.
start
in interface IApplication
context
- the context used to start the application
EXIT_OK
) indicating normal termination if no exception occurs
Exception
- if a problem occurred during the buildfile executionIApplication.start(IApplicationContext)
public void stop()
IApplication
IApplication.start(IApplicationContext)
should already have exited or should exit very soon after this method exits
This method is only called to force an application to exit.
This method will not be called if an application exits normally from
the IApplication.start(IApplicationContext)
method.
Note: This method is called by the platform; it is not intended to be called directly by clients.
stop
in interface IApplication
|
Eclipse Platform Release 3.3 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2007. All rights reserved.