Search code examples
gradleintellij-ideagradlew

How to change the version of the 'default gradle wrapper' in IntelliJ IDEA?


I want to use Gradle 1.10 instead of 1.9. I cannot seem to find where to change this.

If I put this:

task wrapper(type: Wrapper) {
    gradleVersion = '1.10'
}

in my build.gradle and rebuild, it is built with Gradle 1.9 again (so nothing actually happens).

These seem to be all the settings: (and IntelliJ's help section about Gradle doesn't help at all :( ) What does "not configured for the current" project mean?


Solution

  • The easiest way is to execute the following command from the command line (see Upgrading the Gradle Wrapper in documentation):

    ./gradlew wrapper --gradle-version 5.5
    

    Moreover, you can use --distribution-type parameter with either bin or all value to choose a distribution type. Use all distribution type to avoid a hint from IntelliJ IDEA or Android Studio that will offer you to download Gradle with sources:

    ./gradlew wrapper --gradle-version 5.5 --distribution-type all
    

    Or you can create a custom wrapper task

    task wrapper(type: Wrapper) {
        gradleVersion = '5.5'
    }
    

    and run ./gradlew wrapper.