# Interface BuildEnvironment

All Superinterfaces:
  `BuildModel, Model`

public interface BuildEnvironment extends Model, BuildModel
Informs about the build environment, like Gradle version or the Java home in use.

Example:

    ProjectConnection connection = GradleConnector.newConnector()
       .forProjectDirectory(new File("someProjectFolder"))
       .connect();

    try {
       BuildEnvironment env = connection.getModel(BuildEnvironment.class);
       System.out.println("Gradle version: " + env.getGradle().getGradleVersion());
       System.out.println("Java home: " + env.getJava().getJavaHome());
    } finally {
       connection.close();
    }

Since:
  1.0

- ## Method Summary

  Modifier and Type
  Method
  Description
  `BuildIdentifier`
  `getBuildIdentifier()`
  Returns the identifier for the Gradle build that this environment is used by.
  `GradleEnvironment`
  `getGradle()`
  Returns information about the Gradle environment, for example the Gradle version.
  `JavaEnvironment`
  `getJava()`
  Returns information about the Java environment, for example the Java home or the JVM args used.
  `String`
  `getVersionInfo()`
  Returns a rendered version of the Gradle runtime version information.

- ## Method Details

  - ### getBuildIdentifier

    BuildIdentifier getBuildIdentifier()
    Returns the identifier for the Gradle build that this environment is used by.
    Specified by:
      `getBuildIdentifier` in interface `BuildModel`
    Since:
      2.13

  - ### getGradle

    GradleEnvironment getGradle()
    Returns information about the Gradle environment, for example the Gradle version.
    Since:
      1.0

  - ### getJava

    JavaEnvironment getJava() throws UnsupportedMethodException
    Returns information about the Java environment, for example the Java home or the JVM args used.
    Throws:
      `UnsupportedMethodException` - For Gradle versions older than 1.0-milestone-8, where this method is not supported.
    Since:
      1.0

  - ### getVersionInfo

    @Incubating String getVersionInfo()
    Returns a rendered version of the Gradle runtime version information. The result is similar to what is rendered on the console when `gradle --version` is executed.
    Returns:
      the rendered text
    Throws:
      `UnsupportedMethodException` - For Gradle versions older than 9.4.0, where this method is not supported.
    Since:
      9.4.0