gradle
8.5

# BuildEnvironment

interface BuildEnvironment : Model, BuildModel(source)

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();
    }

Content copied to clipboard

## Functions

getBuildIdentifier
Link copied to clipboard
abstract fun getBuildIdentifier(): BuildIdentifier
Returns the identifier for the Gradle build that this environment is used by.
getGradle
Link copied to clipboard
abstract fun getGradle(): GradleEnvironment
Returns information about the Gradle environment, for example the Gradle version.
getJava
Link copied to clipboard
abstract fun getJava(): JavaEnvironment
Returns information about the Java environment, for example the Java home or the JVM args used.