Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.ant.core
Class AntRunner

    java.lang.Object
      org.eclipse.ant.core.AntRunner

All Implemented Interfaces:
  IPlatformRunnable

public class AntRunner
extends Object
implements IPlatformRunnable

Entry point for running Ant builds inside Eclipse.

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.core.runtime.IPlatformRunnable
`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.

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 String[] targets

### userProperties

    protected Map userProperties

### messageOutputLevel

    protected int messageOutputLevel

### buildLoggerClassName

    protected String buildLoggerClassName

### inputHandlerClassName

    protected String inputHandlerClassName

### arguments

    protected String[] arguments

### propertyFiles

    protected String[] propertyFiles

### customClasspath

    protected URL[] customClasspath

### antHome

    protected String antHome

Constructor Detail

### AntRunner

    public AntRunner()

Method Detail

### 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:

  - `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`

  Parameters:
    `level` - the message output level

### setArguments

    public void setArguments(String arguments)

  Sets the arguments to be passed to the build (e.g. -Dos=win32 -Dws=win32 - verbose).

  Parameters:
    `arguments` - the arguments to be passed to the build

### setArguments

    public void setArguments(String[] arguments)

  Sets the arguments to be passed to the build (e.g. -Dos=win32 -Dws=win32 -verbose).

  Parameters:
    `arguments` - the arguments to be passed to the build
  Since:
    2.1

### 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)

  Sets the 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`). Only one build logger is permitted for any build.

  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

### getAvailableTargets

    public TargetInfo[] getAvailableTargets()
                                     throws CoreException

  Returns the buildfile target information.

  Returns:
    an array containing the target information
  Throws:
    `CoreException` - Thrown if problem is encountered determining the targets
  Since:
    2.1
  See Also:
    `TargetInfo`

### run

    public void run(IProgressMonitor monitor)
             throws CoreException

  Runs the build file. 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`. 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.

  Parameters:
    `monitor` - a progress monitor, or `null` if progress reporting and cancellation are not desired
  Throws:
    `CoreException` - Thrown if a build is already occuring or if an exception occurs during the build

### handleInvocationTargetException

    protected void handleInvocationTargetException(Object runner,
                                                   Class classInternalAntRunner,
                                                   InvocationTargetException e)
                                            throws CoreException

  Throws:
    `CoreException`

### problemLoadingClass

    protected void problemLoadingClass(Throwable e)
                                throws CoreException

  Throws:
    `CoreException`

### run

    public void run()
             throws CoreException

  Runs the build file.

  Throws:
    `CoreException` - Thrown if a build is already occuring or if an exception occurs during the build

### 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. Sets the current threads context class loader to the AntClassLoader for the duration of the build.

  Specified by:
    `run` in interface `IPlatformRunnable`
  Parameters:
    `argArray` - the command line arguments
  Returns:
    an exit object (`EXIT_OK`) indicating normal termination if no exception occurs
  Throws:
    `Exception` - if a problem occurred during the buildfile execution
  See Also:
    `IPlatformRunnable.run(java.lang.Object)`

### setInputHandler

    public void setInputHandler(String className)

  Sets the input handler. The parameter `className` is the class name of a `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.

  Parameters:
    `className` - an input handler class name
  Since:
    2.1

### setPropertyFiles

    public void setPropertyFiles(String[] propertyFiles)

  Sets the user specified property files.

  Parameters:
    `propertyFiles` - array of property file paths
  Since:
    2.1

### setCustomClasspath

    public void setCustomClasspath(URL[] customClasspath)

  Sets the custom classpath to use for this build

  Parameters:
    `customClasspath` - array of URLs that define the custom classpath

### setAntHome

    public void setAntHome(String antHome)

  Sets the Ant home to use for this build

  Parameters:
    `antHome` - String specifying the Ant home to use
  Since:
    2.1

### isBuildRunning

    public static boolean isBuildRunning()

  Returns whether an Ant build is already in progress Only one Ant build can occur at any given time.

  Returns:
    boolean
  Since:
    2.1

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
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, 2004. All rights reserved.