Gradle Wrapper

What is Gradle Wrapper?
– Gradle wrapper is simply a way in which we can run any version of gradle without actually downloading the gradle version.

Why to use Gradle Wrapper?
-There are different features and new keywords added into gradle in it every new release, so when build.gradle is created keeping specific version of gradle in mind it so can happen that some keyword and features may get removed or added into some new and older versions of gradle. Hence to run the gradle build file without error in the specific version it was meant to be executed we can use gradle wrapper.

Note : Just like gradle has gradle.properties, gradle wrapper has gradle-wrapper.properties, all the syntax of properties remain the same for warpper properties file as well.

How to use Gradle Wrapper?

gradle wrapper --gradle-version 5.3.1 --distribution-type all
gradlew build

You can also set t he gradle wrapper version in gradle wrapper properties file( gradle/wrapper/gradle-wrapper.properties)

distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip

Upgrading gradle wrapper version

gradlew wrapper --gradle-version 5.4.1

Leave a Reply

Your email address will not be published. Required fields are marked *