GradleConnectionBuilder (Gradle API 2.14.1)

Package: org.gradle.tooling.connection

## [Java] 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
    Modifiers | Name | Description
    --- | --- | ---
    `interface` | `GradleConnectionBuilder.ParticipantBuilder` | Builds a new participant that will be included in the connection.

  - ### Methods Summary

    Methods
    Type | Name 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

    - #### public 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.

    - #### public GradleConnection build()

      Builds the connection. You should call GradleConnection.close when you are finished with the connection.

      throws:
        GradleConnectionException If the composite is invalid (e.g., no participants).
      Returns:
        The connection. Never returns null.

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