Search code examples
gradlehome-directory

Is there important information in the $HOME/.gradle directory?


I'm about to backup my (Linux) home directory, and in the process of culling some of the larger files/subdirectories whose contents I dont need (e.g. .cache, .ccache etc.) - I noticed I have a pretty sizable .gradle subdirectory.

I very rarely use the gradle build tool, but I must have used it for something a couple of years back. My question: Is there important information/settings in a user's .gradle folder, or is it basically just cached dependencies / gradle's own auto-downloaded data?


Solution

  • From the docs:

    https://docs.gradle.org/current/userguide/directory_layout.html#dir:gradle_user_home

    The Gradle user home directory ($USER_HOME/.gradle by default) is used to store global configuration properties and initialization scripts as well as caches and log files.

    Generally, locally it does not matter. However, more advanced use cases (CI/CD) allow you to share or even relocate certain caches: https://docs.gradle.org/current/userguide/build_cache.html

    The only notable item of importance is a global gradle.properties file you may have created. If you did, it would be located at $GRADLE_USER_HOME/gradle.properties where GRADLE_USER_HOME by default is $USER_HOME/.gradle. If there any credentials in there you do not have saved else where, considering backing those up.

    Otherwise, it is safe to delete. Granted you do not mind having to redownload dependencies etc. again.