Java 如何更改 Eclipse SpringSource 插件使用的 Gradle 版本?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19120141/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 14:17:22  来源:igfitidea点击:

How do I change the Gradle version the Eclipse SpringSource plugin uses?

javaeclipsegradlespringsource

提问by Kraagenskul

Note this is for the SpringSource plugin.

请注意,这是针对 SpringSource 插件的。

When I try to import a Gradle project in Eclipse I am getting the following error:

当我尝试在 Eclipse 中导入 Gradle 项目时,出现以下错误:

Project location doesn't exist; See error log for details.

项目位置不存在;有关详细信息,请参阅错误日志。

The stacktrace error is basically this:

堆栈跟踪错误基本上是这样的:

Caused by: java.lang.IllegalArgumentException: Project location doesn't exist

引起:java.lang.IllegalArgumentException:项目位置不存在

I did some research, and a Gradle defect (https://issuetracker.springsource.com/browse/STS-3158) mentions that error handling was improved with a more useful error message, including the project location.

我做了一些研究,一个 Gradle 缺陷 ( https://issuetracker.springsource.com/browse/STS-3158) 提到错误处理得到了改进,提供了更有用的错误消息,包括项目位置。

I have Gradle 1.7 now on my machine; however Eclipse/Springsource keeps using Gradle 1.2. How do I get it to use 1.7 (or even 1.8)

我的机器上现在有 Gradle 1.7;但是 Eclipse/Springsource 一直在使用 Gradle 1.2。我如何让它使用 1.7(甚至 1.8)

采纳答案by Peter Niederwieser

I recommend to check "Preferences->Gradle->Use Gradle wrapper's default" and install the Gradle Wrapperfor all builds in question. Then Eclipse will automatically pick the right Gradle version for each build (and nobody has to install Gradle manually).

我建议检查“Preferences->Gradle->Use Gradle wrapper's default”并为所有有问题的构建安装Gradle Wrapper。然后 Eclipse 会自动为每个构建选择正确的 Gradle 版本(无需手动安装 Gradle)。