DEV Community

Cover image for [Tiny] How to Upgrade Gradle Wrapper
Petr Filaretov
Petr Filaretov

Posted on

[Tiny] How to Upgrade Gradle Wrapper

If you are building projects with Gradle, you most likely use Gradle Wrapper. And of course, you will need to update the Gradle version at some point.

One way to do this is to simply change the Gradle version in the gradle-wrapper.properties file, for instance:

distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
Enter fullscreen mode Exit fullscreen mode

But there is a better way.

Use the wrapper Gradle task to upgrade Gradle Wrapper. It not only updates the Gradle version in the gradle-wrapper.properties file, but it also updates the Wrapper shell script (gradlew), the batch file (gradlew.bat), and the Gradle Wrapper jar (gradle-wrapper.jar).

You can run the wrapper task from the terminal, specifying the latest version

./gradlew wrapper --gradle-version latest
Enter fullscreen mode Exit fullscreen mode

or the specific version you want:

./gradlew wrapper --gradle-version 8.1.1
Enter fullscreen mode Exit fullscreen mode

Alternatively, you can add the wrapper task to the build.gradle.kts script

tasks.wrapper {
    gradleVersion = "8.1.1"
}
Enter fullscreen mode Exit fullscreen mode

and run the wrapper task from the Gradle panel in IntelliJ IDEA.


Dream your code, code your dream.

Top comments (0)