WindowsmacOSLinux

Where Does Gradle Store Dependencies?

Gradle user home and dependency cache paths on Windows, macOS and Linux, and how to clear modules without breaking builds.

Last updated

Gradle caches downloaded dependencies under a .gradle home folder with a modules-2 subfolder holding the actual jars. Wrappers land in wrapper/dists beside caches. The default home sits in your user profile on every OS.

The GRADLE_USER_HOME variable moves everything at once, which helps cramped system drives. Clearing caches is safe but forces full redownloads, so try --refresh-dependencies on one project first. Android Studio shares this same home with its own Gradle versions. Build reports reveal which repository served each artifact when resolution looks odd.

Where Gradle stores this, by platform

Windows
C:\Users\[Username]\.gradle\caches\modules-2

Set GRADLE_USER_HOME to relocate the whole .gradle tree. Delete caches/modules-2 with IDEs closed to force clean redownloads of dependencies.

macOS
~/.gradle/caches/modules-2

Same layout as Linux. Wrapper distributions sit in ~/.gradle/wrapper/dists and often use more disk than the dependency cache itself.

Linux
~/.gradle/caches/modules-2

Respects GRADLE_USER_HOME when exported. CI images mount this path as a cache volume to avoid downloading the internet on every build.

Frequently asked questions

How do I free disk space from Gradle?

Close IDEs, delete ~/.gradle/caches/modules-2/files-2.1 for artifacts and old wrapper/dists entries. Rebuild once to repopulate only what current projects need.

Where are Gradle wrapper distributions?

Inside the same .gradle home under wrapper/dists, one folder per Gradle version. Removing stale versions there is the quickest safe disk win.

Notice an outdated path? Let us know.