Reputation: 40510
I have a gradle project with a lot of dependencies, and running a simple task (that simply prints out the classpath) takes about 12 seconds, even though all the dependencies have been downloaded and are available in cache.
If I turn my network interface off, and run the same task, it completes in about a second.
So, the question is why is gradle talking to internet every time? Is there some flag I can set to make it use the cache more aggressively? I tried googling it, and there is a lot of discussion about how to force gradle NOT use the cache, but I could not find anything about the opposite.
In response to the question in comments, my repositories
config looks like this:
repositories {
maven { url "${artifactoryUrl}/jcenter" }
maven { url "${artifactoryUrl}/libs-release-local" }
maven { url "${artifactoryUrl}/libs-snapshot-local" }
mavenCentral()
maven { url "http://maven.twttr.com" }
}
($artifactoryUrl
points to an instace of artifactory we are running internally).
Upvotes: 0
Views: 575
Reputation: 95558
I know that if you have a dependency where you say that you always want the latest version, gradle will have to check all the repositories until it finds one.
If you don't want gradle to check remote repositories and just use its cache, you can use the --offline
flag (see here).
Upvotes: 4