How to set gradle cache location?

Globally you can set

[…] Gradle user home directory (defined by the “GRADLE_USER_HOME” environment variable, which […] defaults to USER_HOME/.gradle) […]

See also https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_properties_and_system_properties.

Otherwise for every build manually:

-g, –gradle-user-home
Specifies the Gradle user home directory. The default is the .gradle directory in the user’s home directory.

See https://gradle.org/docs/current/userguide/gradle_command_line.html.

Leave a Comment