# setEnvironmentVariables

abstract fun setEnvironmentVariables(@Nullable envVariables: @Nullable Map<String, String>): LongRunningOperation(source)

Specifies the environment variables to use for this operation.

org.gradle.tooling.model.build.BuildEnvironment model contains information such as Java or Gradle environment. If you want to get hold of this information you can ask tooling API to build this model.

If not configured or null is passed, then the reasonable default will be used. *

Note: When this method is called, the provided map completely replaces the environment variables for the operation. To add custom environment variables while preserving system environment variables, first copy the current environment and then add custom values:

     Map<String, String> env = new HashMap<>(System.getenv());
     env.put("MY_VAR", "my_value");
     operation.setEnvironmentVariables(env);

Content copied to clipboard
This is particularly important on Windows, where omitting essential system environment variables may cause the operation to fail.

#### Return

this

#### Since

3.5

#### Parameters

envVariables

environment variables