How to use gradle zip in local system without downloading when using gradle-wrapper

From gradle-wrapper documentation, I found in section 61.1. Configuration

If you don't want any download to happen when your project is build via gradlew, simply add the Gradle distribution zip to your version control at the location specified by your wrapper configuration. A relative URL is supported - you can specify a distribution file relative to the location of gradle-wrapper.properties file.

So, I changed distributionUrl property in gradle-wrapper.properties to

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=gradle-1.11-bin.zip

Then, I made a copy of gradle-1.11-bin.zip in gradle/wrapper/.

Then, ./gradlew build downloaded local copy of zip and built the project.


Modifty the gradle/gradle-wrapper.properties

Windows:

distributionUrl=file\:/d:/gradle-2.2.1-all.zip

linux:

distributionUrl=file\:/tmp/gradle-2.2.1-all.zip

Just drag downloaded gradle file in your browser address bar and then copy address from address bar and change gradle/wrapper/gradle-wrapper.properties as following:

distributionUrl=ADDRESS THAT COPY FROM YOUR BROWSER

example:

distributionUrl=file:///E:/gradle/gradle-4.1-all.zip

or you can copy gradle.zip file to wrapper folder then use relative path:

distributionUrl=gradle.zip

Tags:

Gradle

Gradlew