Gradle store on local file system

Gradle caches artifacts in USER_HOME/.gradle folder. The compiled scripts are usually in the .gradle folder in your project folder.

If you can't find the cache, maybe it's because you have not cached any artifacts yet. You can always see where Gradle has cached artifacts with a simple script:

apply plugin: 'java'

repositories {
    mavenCentral()
}

dependencies {
    compile 'com.google.guava:guava:12.0'
}

task showMeCache doLast() {
    configurations.compileClasspath.each { println it }
}

Now if you run gradle showMeCache it should download the dependencies into the cache and print the full path.


Gradle's local repository folder is:

  • $USER_HOME/.gradle/caches/modules-2/files-2.1

Defined dependencies will be loaded from remote repositories into gradle's local repository folder. For each loaded file, gradle will be create a new folder named with md5 value of the original file (pom,jar,..). Full path for the dependency file is made up from :

  • groupid + artifactid + version + FILE_MD5_VALUE + FILE_NAME

If our defined dependency is:

  • compile 'org.springframework:spring-jdbc:4.3.4.RELEASE'

Then the library will be loaded into :

  • /$USER_HOME/.gradle/caches/modules-2/files-2.1/org.springframework/spring-jdbc/4.3.4.RELEASE/42175d194cf6aa7c716c0887f30255e5c0a5262c/spring-jdbc-4.3.4.RELEASE.jar

On Mac, Linux and Windows i.e. on all 3 of the major platforms, Gradle stores dependencies at:

~/.gradle/caches/modules-2/files-2.1

In Windows 10 PC, it is saved at:

C:\Users\%USERNAME%\.gradle\caches\modules-2\files-2.1\

Tags:

Gradle