I have Gradle 6.2.2 running on my system (Mac) and I need it to stay on 6.2.2 for a few critical projects that I run locally.
I just cloned another project, one maintained by other developers who are all using Gradle 6.7.1. It is a Spring Boot app. When I run any of its Gradle commands on the command-line I get:
> Failed to apply plugin [id 'org.springframework.boot']
> Spring Boot plugin requires Gradle 5 (5.6.x only) or Gradle 6 (6.3 or later). The current version is Gradle 6.2.2
So it looks like Spring Boot wants me to be on Gradle 6.3+.
My understanding of the Gradle Wrapper (please correct me if I'm wrong) is:
- you modify
build.gradle
with awrapper
directive that specifies which version of Gradle to use for the project - you then run
gradle wrapper
on the command line and Gradle downloads & caches (somewhere) that version of Gradle for you - now you can run your normal Gradle commands, but instead of
gradle
you usegradlew
and that tells Gradle to use the version of Gradle specified in the wrapper directive
If any of that is incorrect or misleading, please begin by correcting me! Assuming its more or less correct...
I added the following directive in the project's build.gradle
:
wrapper{
gradleVersion = '6.7.1'
distributionType = Wrapper.DistributionType.BIN
}
My hope here is that although I am using 6.2.2 locally on my system, this will tell Gradle to fetch and use Gradle v6.7.1 which we know is compatible with the rest of the project's build.
I then go to run gradle wrapper
from the project root on my command-line:
$ gradle wrapper
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/myuser/workspace/the-new-project/build.gradle' line: 27
* What went wrong:
An exception occurred applying plugin request [id: 'org.springframework.boot', version: '2.3.2.RELEASE']
> Failed to apply plugin [id 'org.springframework.boot']
> Spring Boot plugin requires Gradle 5 (5.6.x only) or Gradle 6 (6.3 or later). The current version is Gradle 6.2.2
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 702ms
Any ideas as to what is going on here? How do I tell Gradle to download and use 6.7.1 but not touch my local version of 6.2.2?