While shifting my project from Ubuntu to Mac, I copied the Java dependencies and jars from the ~/.gradle/cache
on Ubuntu to ~/.gradle/caches/artifacts
on Mac to avoid having gradle download the dependencies all over again. To my surprise, running gradle idea
(we are using Intellij Idea) emptied the ~/.gradle/caches/artifacts
folder and started downloading the dependencies again, nevertheless
I saw numerous resources and questions on SOF talk about forcing gradle to redownload the dependencies (using the --refresh-dependencies flag, for example), but none so far on how to prevent gradle from doing that and instead look into its local cache.
Is there a flag or switch which can help achieve this task?
I am using gradle 1.0-milestone-3, and unfortunately, don't have the privilege to upgrade it anytime soon.
There's --offline flag which prevents Gradle from accessing network resources. As a consequence it will use Gradle dependency cache and not try to refresh the dependencies from the remote server. See How to configure gradle to work "offline" (using cached dependencies).
Of course, as lance-java mentioned in his answer relocatable dependency cache is a v6.1+ feature (see Make dependency caches relocateable#1338) and therefore won't work for caches generated with earlier Gradle versions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With