GradleConnectionBuilder (Gradle API 2.14.1)

org.gradle.tooling.connection

## Interface GradleConnectionBuilder

-     @Incubating
      public interface GradleConnectionBuilder

  Builds a new composite Gradle connection.

       GradleConnectionBuilder builder = GradleConnector.newGradleConnection();
       // Add a participant with root directory 'someFolder' using the Gradle version defined in the build
       builder.addParticipant(new File("someFolder"));
       // Add a participant with root directory 'someOtherFolder' using Gradle Version 2.6
       builder.addParticipant(new File("someOtherFolder")).useGradleVersion("2.6");
       // Set the Gradle user home for the entire connection
       builder.useGradleUserHomeDir(new File("/path/to/.gradle"));
       GradleConnection connection = builder.build();

       try {
          // Use connection
       } finally {
          connection.close();
       }

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `GradleConnectionBuilder.ParticipantBuilder` Builds a new participant that will be included in the connection.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `GradleConnectionBuilder.ParticipantBuilder` | `addParticipant(File projectDirectory)` Adds a new participant build to this connection, returning a build for further configuration.
    `GradleConnection` | `build()` Builds the connection.
    `GradleConnectionBuilder` | `useGradleUserHomeDir(File gradleUserHomeDir)` Specifies the user's Gradle home directory to use.

- - ### Method Detail

    - #### useGradleUserHomeDir

          GradleConnectionBuilder useGradleUserHomeDir(File gradleUserHomeDir)

      Specifies the user's Gradle home directory to use. Defaults to `~/.gradle`.
      Parameters:
        `gradleUserHomeDir` - The user's Gradle home directory to use.
      Returns:
        this

    - #### addParticipant

          GradleConnectionBuilder.ParticipantBuilder addParticipant(File projectDirectory)

      Adds a new participant build to this connection, returning a build for further configuration.
      Parameters:
        `projectDirectory` - The root project directory for the participant.
      Returns:
        The builder. Never returns null.

    - #### build

          GradleConnection build()
                                 throws GradleConnectionException

      Builds the connection. You should call `GradleConnection.close()` when you are finished with the connection.
      Returns:
        The connection. Never returns null.
      Throws:
        `GradleConnectionException` - If the composite is invalid (e.g., no participants).