DEV Community

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

Posted on

12

[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.

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay