How does Gradle store downloaded jar files on the local file system? Maven stores them in the .m2
directory under USER_HOME
, but where does Gradle
It took me a while to realize this, hence the additional answer. Hopefully it can save folks time. Note that if you are running sudo gradle
the dependencies may not be in your home directory, even if sudo echo $HOME
returns /Users/<my-non-root-user>/
. On my Mac, Gradle was caching the dependencies in /private/var/root/.gradle/caches/
.
You can use the gradle argument --project-cache-dir "/Users/whatever/.gradle/"
to force the gradle cache directory.
In this way you can be darn sure you know what directory is being used (as well as create different caches for different projects)
Many answers are correct! I want to add that you can easily find your download location with
gradle --info build
like described in https://stackoverflow.com/a/54000767/4471199.
New downloaded artifacts will be shown in stdout:
Downloading https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-parent/2.1.7.RELEASE/spring-boot-parent-2.1.7.RELEASE.pom to /tmp/gradle_download551283009937119777bin
In this case, I used the docker image gradle:5.6.2-jdk12
.
As you can see, the docker container uses /tmp
as download location.