gradlew包装器更新到新版本错误,您有旧版本



渐变构建失败的原因:

./gradlew wrapper --gradle-version 6.2
FAILURE: Build failed with an exception.
* Where:
Build file '/home/yburtsev/IdeaProjects/spring-io-testcontainers-workshop/build.gradle' line: 3
* What went wrong:
An exception occurred applying plugin request [id: 'org.springframework.boot', version: '2.2.4.RELEASE']
> Failed to apply plugin [id 'org.springframework.boot']
> Spring Boot plugin requires Gradle 4.10 or later. The current version is Gradle 4.4.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 0s

我手动将gradle-wrapper.properties中的distributionUrl编辑到6.2版本,然后成功运行gradle-wwrapper命令。

项目链接:https://github.com/bsideup/spring-io-testcontainers-workshop

wrapper任务将首先使用以前版本的Gradle运行。在你的情况下,这显然是4.4.1。我不知道它为什么为包装任务评估整个项目构建,但它确实这样做了。由于您使用的插件与该版本不兼容,因此它会失败。

正如您已经做过的那样,可以通过手动编辑文件gradle/wrapper/gradle-wrapper.properties并将其设置为新版本来规避此问题。但请记住,在执行完包装任务后,请再次运行该任务。这将使它下载新版本,并在需要时使用它来更新其他包装文件。

此问题存在相应的Github问题。如果你喜欢,你可以对它竖起大拇指,给予更多关注:https://github.com/gradle/gradle/issues/884.

最新更新