无法将Gradle包装器从版本2.1升级到6.5.1

时间:2020-07-04 02:48:59

标签: gradle upgrade gradlew gradle-2 gradle-6.5.1

我有一个使用Gradle 2.1的旧项目。今天,我想将gradle包装器版本“升级”到6.5.1,所以我用了这个:

./gradlew wrapper --gradle-version 6.5.1

但是输出是:

FAILURE: Build failed with an exception.

* What went wrong:
Problem configuring task :wrapper from command line.
> Unknown command-line option '--gradle-version'.

* Try:
Run gradlew help --task :wrapper to get task usage details. Run with --stacktrace option to get the stack trace. Run with                                                                                                                      --info                                                                                                                   or                                                                                                                     --debug                                                                                                                  option to get more log output.

好像参数--gradle-version当时不可用(2.1)。尝试了很多谷歌搜索,没有任何运气。您能告诉我如何克服这个问题吗? 谢谢。

1 个答案:

答案 0 :(得分:0)

您可以手动编辑<prj_home>/gradle/wrapper/gradle-wrapper.properties

设置distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip

然后./gradlew wrapper将起作用