Eclipse Platform
2.0

org.eclipse.ant.core
Class AntRunner

java.lang.Object
  |
  +--org.eclipse.ant.core.AntRunner
All Implemented Interfaces:
org.eclipse.ant.internal.core.IAntCoreConstants, IPlatformRunnable

public class AntRunner
extends Object
implements IPlatformRunnable, org.eclipse.ant.internal.core.IAntCoreConstants

Entry point for running Ant scripts inside Eclipse.


Field Summary
protected  String arguments
           
protected  String buildFileLocation
           
protected  List buildListeners
           
protected  String buildLoggerClassName
           
protected  int messageOutputLevel
           
protected  Vector targets
           
protected  Map userProperties
           
 
Fields inherited from interface org.eclipse.core.boot.IPlatformRunnable
EXIT_OK, EXIT_RESTART
 
Fields inherited from interface org.eclipse.ant.internal.core.IAntCoreConstants
DEFAULT_BUILD_FILENAME, ERROR_LIBRARY_NOT_SPECIFIED, ERROR_MALFORMED_URL, ERROR_RUNNING_SCRIPT, PI_ANTCORE, PREFERENCE_TASKS, PREFERENCE_TYPES, PREFERENCE_URLS, PREFIX_TASK, PREFIX_TYPE, PREFIX_URL
 
Constructor Summary
AntRunner()
          Constructs an instance of this class.
 
Method Summary
 void addBuildListener(String className)
          Adds a build listener.
 void addBuildLogger(String className)
          Adds a build logger.
 void addUserProperties(Map properties)
          Adds user-defined properties.
protected  ClassLoader getClassLoader()
           
 void run()
          Runs the build script.
 void run(IProgressMonitor monitor)
          Runs the build script.
 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 setArguments(String arguments)
          Sets the arguments to be passed to the script (e.g.
 void setBuildFileLocation(String buildFileLocation)
          Sets the build file location on the file system.
 void setExecutionTargets(String[] executionTargets)
          Sets the targets and execution order.
 void setMessageOutputLevel(int level)
          Set the message output level.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

buildFileLocation

protected String buildFileLocation

buildListeners

protected List buildListeners

targets

protected Vector targets

userProperties

protected Map userProperties

messageOutputLevel

protected int messageOutputLevel

buildLoggerClassName

protected String buildLoggerClassName

arguments

protected String arguments
Constructor Detail

AntRunner

public AntRunner()
Constructs an instance of this class.

Method Detail

getClassLoader

protected ClassLoader getClassLoader()

setBuildFileLocation

public void setBuildFileLocation(String buildFileLocation)
Sets the build file location on the file system.

Parameters:
buildFileLocation - the file system location of the build file

setMessageOutputLevel

public void setMessageOutputLevel(int level)
Set the message output level.

Valid values are:

Parameters:
level - the message output level

setArguments

public void setArguments(String arguments)
Sets the arguments to be passed to the script (e.g. -Dos=win32 -Dws=win32 -verbose).

Parameters:
arguments - the arguments to be passed to the script

setExecutionTargets

public void setExecutionTargets(String[] executionTargets)
Sets the targets and execution order.

Parameters:
executionTargets - which targets should be run and in which order

addBuildListener

public void addBuildListener(String className)
Adds a build listener. The parameter className is the class name of a 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).

Parameters:
className - a build listener class name

addBuildLogger

public void addBuildLogger(String className)
Adds a build logger. The parameter className is the class name of a 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).

Parameters:
className - a build logger class name

addUserProperties

public void addUserProperties(Map properties)
Adds user-defined properties. Keys and values must be String objects.

Parameters:
properties - a Map of user-defined properties

run

public void run(IProgressMonitor monitor)
         throws CoreException
Runs the build script. If a progress monitor is specified it will be available during the script execution as a reference in the Ant Project (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.

Parameters:
monitor - a progress monitor, or null if progress reporting and cancellation are not desired
CoreException

run

public void run()
         throws CoreException
Runs the build script.

CoreException

run

public Object run(Object argArray)
           throws Exception
Invokes the building of a project object and executes a build using either a given target or the default target. This method is called when running Eclipse headless and specifying org.eclipse.ant.core.antRunner as the application.

Specified by:
run in interface IPlatformRunnable
Parameters:
argArray - the command line arguments
Throws:
Exception - if a problem occurred during the script execution

Eclipse Platform
2.0

Copyright (c) IBM Corp. and others 2000, 2002. All Rights Reserved.