Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | METHOD | DETAIL: FIELD | METHOD

## org.gradle.tooling
[Java] Interface BuildLauncher

    public interface BuildLauncher

A `BuildLauncher` allows you to configure and execute a Gradle build.

You use a `BuildLauncher` as follows:

- Create an instance of `BuildLauncher` by calling ProjectConnection.newBuild.
- Configure the launcher as appropriate.
- Call either run() or run(ResultHandler) to execute the build.
- Optionally, you can reuse the launcher to launcher additional builds.

Instances of `BuildLauncher` are not thread-safe.

Method Summary
`BuildLauncher` | `addProgressListener(ProgressListener listener)` Adds a progress listener which will receive progress events as the build executes.
`BuildLauncher` | `forTasks(java.lang.String... tasks)` Sets the tasks to be executed.
`BuildLauncher` | `forTasks(Task... tasks)` Sets the tasks to be executed.
`BuildLauncher` | `forTasks(java.lang.Iterable tasks)` Sets the tasks to be executed.
`void` | `run()` Execute the build, blocking until it is complete.
`void` | `run(ResultHandler handler)` Launchers the build.
`BuildLauncher` | `setStandardError(java.io.OutputStream outputStream)` Sets the java.io.OutputStream that should receive standard error logging from this build.
`BuildLauncher` | `setStandardOutput(java.io.OutputStream outputStream)` Sets the java.io.OutputStream that should receive standard output logging from this build.

Method Detail

### addProgressListener

    public BuildLauncher addProgressListener(ProgressListener listener)

  Adds a progress listener which will receive progress events as the build executes.
  Parameters:
    `listener` - The listener
  Returns:
    this

### forTasks

    public BuildLauncher forTasks(java.lang.String... tasks)

  Sets the tasks to be executed.
  Parameters:
    `tasks` - The paths of the tasks to be executed. Relative paths are evaluated relative to the project for which this launcher was created.
  Returns:
    this

### forTasks

    public BuildLauncher forTasks(Task... tasks)

  Sets the tasks to be executed. Note that the supplied tasks do not necessarily belong to the project which this launcher was created for.
  Parameters:
    `tasks` - The tasks to be executed.
  Returns:
    this

### forTasks

    public BuildLauncher forTasks(java.lang.Iterable tasks)

  Sets the tasks to be executed. Note that the supplied tasks do not necessarily belong to the project which this launcher was created for.
  Parameters:
    `tasks` - The tasks to be executed.
  Returns:
    this

### run

    public void run()

  Execute the build, blocking until it is complete.
  throws:
    UnsupportedVersionException When the target Gradle version does not support the features required for this build.
  throws:
    BuildException On some failure executing the Gradle build.
  throws:
    GradleConnectionException On some other failure using the connection.
  throws:
    IllegalStateException When the connection has been closed or is closing.

### run

    public void run(ResultHandler handler)

  Launchers the build. This method returns immediately, and the result is later passed to the given handler.
  throws:
    IllegalStateException When the connection has been closed or is closing.
  Parameters:
    `handler` - The handler to supply the result to.

### setStandardError

    public BuildLauncher setStandardError(java.io.OutputStream outputStream)

  Sets the java.io.OutputStream that should receive standard error logging from this build. The default is to discard the output.
  Parameters:
    `outputStream` - The output stream.
  Returns:
    this

### setStandardOutput

    public BuildLauncher setStandardOutput(java.io.OutputStream outputStream)

  Sets the java.io.OutputStream that should receive standard output logging from this build. The default is to discard the output.
  Parameters:
    `outputStream` - The output stream.
  Returns:
    this

Groovy Documentation