demonSlayer
demonSlayer

Reputation: 315

How to stop gradle from downloading every time

I have installed gradle in Ubuntu 16.04.
Here is the output for gradle -v

------------------------------------------------------------
Gradle 2.10
------------------------------------------------------------

Build time:   2016-01-26 15:17:49 UTC
Build number: none
Revision:     UNKNOWN

Groovy:       2.4.5
Ant:          Apache Ant(TM) version 1.9.6 compiled on July 8 2015
JVM:          1.8.0_101 (Oracle Corporation 25.101-b13)
OS:           Linux 4.4.0-38-generic amd64

But even now, whenever I create a new project based on gradle v2.10, it downloads it and then builds the project. According to the tutorials, after installing it, I shouldn't need to download it again. What is the problem here?

Upvotes: 16

Views: 10815

Answers (2)

sansoft infotech
sansoft infotech

Reputation: 91

you will have to replace url with local path like this

distributionUrl = file\:///e:/android/gradle-2.10-bin.zip

and comment

distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip

in gradle-wrapper.properties

Upvotes: 9

lance-java
lance-java

Reputation: 27986

I think you have two concepts mixed up:

  1. A manual installation of gradle (gradle.bat / gradle.sh)
  2. The gradle wrapper (gradlew.bat / gradlew.sh)

When you mention executing gradle -v this has absolutely no effect on the gradle wrapper. The wrapper works independently of any manually installed gradle versions.

Since you are referencing gradle being downloaded I assume you are discussing the gradle wrapper (gradlew). The wrapper will first check if it has downloaded the version previously by checking the cache stored under $GRADLE_USER_HOME so will only ever download each version once. Subsequent gradlew invocations will use the previously downloaded/unzipped installation.

Upvotes: 4

Related Questions