mudasar187
02/16/2023, 9:35 AMbuild.gradle.kts
withType<Wrapper>().configureEach {
gradleVersion = "7.6"
}
?CLOVIS
02/16/2023, 9:36 AMgradle/wrapper/gradle-wrapper.properties
, which is read by the launcher script before the wrapper is startedmudasar187
02/16/2023, 9:38 AMCLOVIS
02/16/2023, 9:39 AM:wrapper
task and it will download it), but it's easier to run ./gradlew wrapper --gradle-version 8.0
mudasar187
02/16/2023, 9:40 AMChrimaeon
02/16/2023, 9:52 AMgradle wrapper
it will update al necessary resources even the gradlew
scripts if they where updated.mudasar187
02/16/2023, 9:56 AM./gradlew wrapper --gradle-version 8.0
🙂Chrimaeon
02/16/2023, 9:58 AMCLOVIS
02/16/2023, 9:58 AM:wrapper
every time you touch itgradle-wrapper.properties
or run the wrapper task with the new version number and you have nothing more to doChrimaeon
02/16/2023, 10:00 AMCLOVIS
02/16/2023, 10:01 AM:wrapper
on their machine each time they change branches, or risk use the wrong Gradle version?mudasar187
02/16/2023, 10:03 AMVampire
02/16/2023, 11:53 AMDoes that even work? It's the wrapper which executes this, it can't change its own versionYes it works, it just does not do what you think it does. It configures the
wrapper
task which version to put into gradle/wrapper/gradle-wrapper.properties
, it does not influence the current invocation of the wrapper.
And because of that you also always have to call the wrapper
task twice for a proper update, because the templates for the 4 wrapper files are taken from the currently running Gradle version. When you use the wrapper
task to update the Gradle version, you effectively just change the version in the properties file (unless your wrapper files were from an even older Gradle version). Running the wrapper
task again then update the wrapper files from the new version now already being used.
Configuring the wrapper task in the build script has imho only one use-case. If you are disallowed to check in the wrapper files to VCS by some guidelines, then you can define there the version and wrapper checksum and so on, so that you can generate the wrapper files consistently after checkout of the project with some other projects wrapper or an installed Gradle version.