尽管我似乎安装了正确的版本,但出现 Gradle 版本错误
Getting a Gradle verion error even thoughn I appear to have the correct version installed
我在 运行 构建 Gradle 时遇到此错误:
$ ./gradlew clean build
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/paulcarron/Documents/Documents/Books/Learning Spring Boot 2/learning-spring-boot-2/build.gradle' line: 2
* What went wrong:
An exception occurred applying plugin request [id: 'org.springframework.boot', version: '2.3.1.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.0.1
* 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 759ms
虽然我安装了 Gradne 6.5:
$ gradle -v
------------------------------------------------------------
Gradle 6.5
------------------------------------------------------------
Build time: 2020-06-02 20:46:21 UTC
Revision: a27f41e4ae5e8a41ab9b19f8dd6d86d7b384dad4
Kotlin: 1.3.72
Groovy: 2.5.11
Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM: 1.8.0_121 (Oracle Corporation 25.121-b13)
OS: Mac OS X 10.15.5 x86_64
这里可能是什么问题?
只是为了在评论中对正确答案进行细微差别。
程序 gradle
(如果有)会调用系统上安装的 Gradle。它可能是从您的 PATH 变量中找到的。
gradlew
脚本(注意 'w')是一个包装脚本,通常添加到 Git 存储库中。它调用 Gradle 的已声明版本,如有必要会预先自动下载。它使用自己的安装文件夹(默认 ~/.gradle/wrapper
),版本在 [repo]/gradle/wrapper/gradle-wrapper.properties
中声明。
虽然您可以手动更改版本,但最好 运行 ./gradle wrapper --gradle-version 6.5 --distribution-type all
因为如果需要,这也会更新包装脚本本身。
我在 运行 构建 Gradle 时遇到此错误:
$ ./gradlew clean build
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/paulcarron/Documents/Documents/Books/Learning Spring Boot 2/learning-spring-boot-2/build.gradle' line: 2
* What went wrong:
An exception occurred applying plugin request [id: 'org.springframework.boot', version: '2.3.1.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.0.1
* 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 759ms
虽然我安装了 Gradne 6.5:
$ gradle -v
------------------------------------------------------------
Gradle 6.5
------------------------------------------------------------
Build time: 2020-06-02 20:46:21 UTC
Revision: a27f41e4ae5e8a41ab9b19f8dd6d86d7b384dad4
Kotlin: 1.3.72
Groovy: 2.5.11
Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM: 1.8.0_121 (Oracle Corporation 25.121-b13)
OS: Mac OS X 10.15.5 x86_64
这里可能是什么问题?
只是为了在评论中对正确答案进行细微差别。
程序 gradle
(如果有)会调用系统上安装的 Gradle。它可能是从您的 PATH 变量中找到的。
gradlew
脚本(注意 'w')是一个包装脚本,通常添加到 Git 存储库中。它调用 Gradle 的已声明版本,如有必要会预先自动下载。它使用自己的安装文件夹(默认 ~/.gradle/wrapper
),版本在 [repo]/gradle/wrapper/gradle-wrapper.properties
中声明。
虽然您可以手动更改版本,但最好 运行 ./gradle wrapper --gradle-version 6.5 --distribution-type all
因为如果需要,这也会更新包装脚本本身。