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

## org.gradle
Class GradleLauncher

    java.lang.Object
      org.gradle.GradleLauncher

    public abstract class GradleLauncher

extends Object

`GradleLauncher` is the main entry point for embedding Gradle. You use this class to manage a Gradle build, as follows:

1. Optionally create a `StartParameter` instance and configure it with the desired properties. The properties of `StartParameter` generally correspond to the command-line options of Gradle. You can use `createStartParameter(String...)` to create a `StartParameter` from a set of command-line options.
2. Obtain a `GradleLauncher` instance by calling `newInstance(org.gradle.StartParameter)`, passing in the `StartParameter`, or an array of Strings that will be treated as command line arguments.
3. Optionally add one or more listeners to the `GradleLauncher`.
4. Call `run()` to execute the build. This will return a `BuildResult`. Note that if the build fails, the resulting exception will be contained in the `BuildResult`.
5. Query the build result. You might want to call `BuildResult.rethrowFailure()` to rethrow any build failure.

Constructor Summary
`GradleLauncher()`

Method Summary
`abstract void` | `addListener(Object listener)` Adds a listener to this build instance.
`abstract void` | `addStandardErrorListener(StandardOutputListener listener)` Adds a `StandardOutputListener` to this build instance.
`abstract void` | `addStandardOutputListener(StandardOutputListener listener)` Adds a `StandardOutputListener` to this build instance.
`static StartParameter` | `createStartParameter(String... commandLineArgs)` Returns a StartParameter object out of command line syntax arguments.
`abstract BuildResult` | `getBuildAnalysis()` Evaluates the settings and all the projects.
`abstract BuildResult` | `getBuildAndRunAnalysis()` Evaluates the settings and all the projects.
`static void` | `injectCustomFactory(GradleLauncherFactory gradleLauncherFactory)`
`static GradleLauncher` | `newInstance(StartParameter startParameter)` Returns a GradleLauncher instance based on the passed start parameter.
`static GradleLauncher` | `newInstance(String... commandLineArgs)` Returns a GradleLauncher instance based on the passed command line syntax arguments.
`abstract BuildResult` | `run()` Executes the build for this GradleLauncher instance and returns the result.
`abstract void` | `useLogger(Object logger)` Use the given listener.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### GradleLauncher

    public GradleLauncher()

Method Detail

### run

    public abstract BuildResult run()

  Executes the build for this GradleLauncher instance and returns the result. Note that when the build fails, the exception is available using `BuildResult.getFailure()`.

  Returns:
    The result. Never returns null.

### getBuildAnalysis

    public abstract BuildResult getBuildAnalysis()

  Evaluates the settings and all the projects. The information about available tasks and projects is accessible via the `Gradle.getRootProject()` object.

  Returns:
    A BuildResult object. Never returns null.

### getBuildAndRunAnalysis

    public abstract BuildResult getBuildAndRunAnalysis()

  Evaluates the settings and all the projects. The information about available tasks and projects is accessible via the `Gradle.getRootProject()` object. Fills the execution plan without running the build. The tasks to be executed tasks are available via `Gradle.getTaskGraph()`.

  Returns:
    A BuildResult object. Never returns null.

### newInstance

    public static GradleLauncher newInstance(StartParameter startParameter)

  Returns a GradleLauncher instance based on the passed start parameter.

  Parameters:
    `startParameter` - The start parameter object the GradleLauncher instance is initialized with
  Returns:
    The GradleLauncher. Never returns null.

### newInstance

    public static GradleLauncher newInstance(String... commandLineArgs)

  Returns a GradleLauncher instance based on the passed command line syntax arguments. Certain command line arguments won't have any effect if you choose this method (e.g. -v, -h). If you want to act upon, you better use `createStartParameter(String...)` in conjunction with `newInstance(String...)`.

  Parameters:
    `commandLineArgs` - A String array where each element denotes an entry of the Gradle command line syntax
  Returns:
    The GradleLauncher. Never returns null.

### createStartParameter

    public static StartParameter createStartParameter(String... commandLineArgs)

  Returns a StartParameter object out of command line syntax arguments. Every possible command line option has it associated field in the StartParameter object.

  Parameters:
    `commandLineArgs` - A String array where each element denotes an entry of the Gradle command line syntax
  Returns:
    The GradleLauncher. Never returns null.

### injectCustomFactory

    public static void injectCustomFactory(GradleLauncherFactory gradleLauncherFactory)

### addListener

    public abstract void addListener(Object listener)

  Adds a listener to this build instance. The listener is notified of events which occur during the execution of the build. See `Gradle.addListener(Object)` for supported listener types.

  Parameters:
    `listener` - The listener to add. Has no effect if the listener has already been added.

### useLogger

    public abstract void useLogger(Object logger)

  Use the given listener. See `Gradle.useLogger(Object)` for details.

  Parameters:
    `logger` - The logger to use.

### addStandardOutputListener

    public abstract void addStandardOutputListener(StandardOutputListener listener)

  Adds a `StandardOutputListener` to this build instance. The listener is notified of any text written to standard output by Gradle's logging system

  Parameters:
    `listener` - The listener to add. Has no effect if the listener has already been added.

### addStandardErrorListener

    public abstract void addStandardErrorListener(StandardOutputListener listener)

  Adds a `StandardOutputListener` to this build instance. The listener is notified of any text written to standard error by Gradle's logging system

  Parameters:
    `listener` - The listener to add. Has no effect if the listener has already been added.

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