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

## org.gradle.api.invocation
Interface Gradle

    interface Gradle

A `Gradle` represents an invocation of Gradle.

You can obtain a `Gradle` instance by calling Project#getGradle(). In your build file you can use `gradle` to access it.

Method Summary
`void` | `addBuildListener(BuildListener buildListener)` Adds a {
`void` | `addListener(java.lang.Object listener)` Adds the given listener to this build.
`ProjectEvaluationListener` | `addProjectEvaluationListener(ProjectEvaluationListener listener)` Adds a listener to this build, to receive notifications as projects are evaluated.
`void` | `afterProject(Closure closure)` Adds a closure to be called immediately after a project is evaluated.
`void` | `beforeProject(Closure closure)` Adds a closure to be called immediately before a project is evaluated.
`void` | `captureStandardOutput(LogLevel level)` Starts redirection of standard output during to the logging system during init script evaluation.
`void` | `disableStandardOutputCapture()` Disables redirection of standard output during init script evaluation.
`Gradle` | `getGradle()` Returns this {
`File` | `getGradleHomeDir()` Returns the Gradle home directory.
`File` | `getGradleUserHomeDir()` Returns the Gradle user home directory.
`java.lang.String` | `getGradleVersion()` Returns the current Gradle version.
`ScriptHandler` | `getInitscript()` Returns the init script handler for this build.
`InternalRepository` | `getInternalRepository()` Returns the repository used to pass artifacts between projects in this build.
`Logger` | `getLogger()` Returns the logger for this build.
`Project` | `getRootProject()` Returns the root project of this build.
`StartParameter` | `getStartParameter()` Returns the {
`TaskExecutionGraph` | `getTaskGraph()` Returns the {
`void` | `initscript(Closure configureClosure)` Configures the init script classpath for this build.
`void` | `removeListener(java.lang.Object listener)` Removes the given listener from this build.
`void` | `removeProjectEvaluationListener(ProjectEvaluationListener listener)` Removes the given listener from this build.

Method Detail

### addBuildListener

    public void addBuildListener(BuildListener buildListener)

  Adds a BuildListener to this Build instance. The listener is notified of events which occur during the execution of the build.

  param:
    buildListener The listener to add.

### addListener

    public void addListener(java.lang.Object listener)

  Adds the given listener to this build.
  param:
    listener The listener to add. Does nothing if this listener has already been added.

### addProjectEvaluationListener

    public ProjectEvaluationListener addProjectEvaluationListener(ProjectEvaluationListener listener)

  Adds a listener to this build, to receive notifications as projects are evaluated.
  param:
    listener The listener to add. Does nothing if this listener has already been added.
  return:
    The added listener.

### afterProject

    public void afterProject(Closure closure)

  Adds a closure to be called immediately after a project is evaluated. The project is passed to the closure as the first parameter. The project evaluation failure, if any, is passed as the second parameter. Both parameters are options.
  param:
    closure The closure to execute.

### beforeProject

    public void beforeProject(Closure closure)

  Adds a closure to be called immediately before a project is evaluated. The project is passed to the closure as a parameter.
  param:
    closure The closure to execute.

### captureStandardOutput

    public void captureStandardOutput(LogLevel level)

  Starts redirection of standard output during to the logging system during init script evaluation. By default redirection is enabled and the output is redirected to the QUIET level. System.err is always redirected to the ERROR level. Redirection of output at execution time can be configured via the tasks. For more fine-grained control on redirecting standard output see org.gradle.api.logging.StandardOutputLogging.
  param:
    level The level standard out should be logged to.
  see:
    #disableStandardOutputCapture()

### disableStandardOutputCapture

    public void disableStandardOutputCapture()

  Disables redirection of standard output during init script evaluation. By default redirection is enabled.
  see:
    #captureStandardOutput(org.gradle.api.logging.LogLevel)

### getGradle

    public Gradle getGradle()

  Returns this `Gradle` instance.
  return:
    this. Never returns null.

### getGradleHomeDir

    public File getGradleHomeDir()

  Returns the Gradle home directory. This directory is used to locate resources such as the default imports file.

  return:
    The home directory. Never returns null.

### getGradleUserHomeDir

    public File getGradleUserHomeDir()

  Returns the Gradle user home directory. This directory is used to cache downloaded resources.

  return:
    The user home directory. Never returns null.

### getGradleVersion

    public java.lang.String getGradleVersion()

  Returns the current Gradle version.

  return:
    The Gradle version. Never returns null.

### getInitscript

    public ScriptHandler getInitscript()

  Returns the init script handler for this build. You can use this handler to manage the classpath used to compile and execute the build's init scripts.
  return:
    the classpath handler. Never returns null.

### getInternalRepository

    public InternalRepository getInternalRepository()

  Returns the repository used to pass artifacts between projects in this build.
  return:
    The internal repository. Never returns null.

### getLogger

    public Logger getLogger()

  Returns the logger for this build. You can use this in your init scripts to write log messages.
  return:
    The logger. Never returns null.

### getRootProject

    public Project getRootProject()

  Returns the root project of this build.

  return:
    The root project. Never returns null.

### getStartParameter

    public StartParameter getStartParameter()

  Returns the StartParameter used to start this build.
  return:
    The start parameter. Never returns null.

### getTaskGraph

    public TaskExecutionGraph getTaskGraph()

  Returns the TaskExecutionGraph for this build.

  return:
    The task graph. Never returns null.

### initscript

    public void initscript(Closure configureClosure)

  Configures the init script classpath for this build. The given closure is executed against this build's ScriptHandler. The ScriptHandler is passed to the closure as the closure's delegate.
  param:
    configureClosure the closure to use to configure the init script classpath.

### removeListener

    public void removeListener(java.lang.Object listener)

  Removes the given listener from this build.
  param:
    listener The listener to remove. Does nothing if this listener has not been added.

### removeProjectEvaluationListener

    public void removeProjectEvaluationListener(ProjectEvaluationListener listener)

  Removes the given listener from this build.
  param:
    listener The listener to remove. Does nothing if this listener has not been added.

Groovy Documentation