eclipse 如何将 gradle 项目导入 STS 3.7.2

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/34214685/
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-09-19 22:58:53  来源:igfitidea点击:

How to import gradle project into STS 3.7.2

javaeclipsegradlespring-tool-suite

提问by piotrek

i download fresh STS, do 'import' and... there is nothing related to gradle.

我下载了新的 STS,进行了“导入”,然后……没有任何与 gradle 相关的内容。

do i have to install some plugins first? or maybe preferred way is to add apply plugin 'eclipse'and run gradle eclipsefirst? what is the suggested way?

我必须先安装一些插件吗?或者可能首选的方法是先添加apply plugin 'eclipse'并运行gradle eclipse?建议的方法是什么?

回答by Martin Lippert

There are three options to import Gradle projects into STS/Eclipse:

有三个选项可以将 Gradle 项目导入 STS/Eclipse:

  • install the Gradle Integration for Eclipse via the STS dashboard or the Eclipse marketplace and use that. This fits into the STS picture and integrates with its components.
  • install the Buildship project, this is the "official" Gradle integration for Eclipse from Eclipse and this should be the extension of your choice looking forward.
  • use Gradle to create Eclipse-specific project metadata and import the project as existing Eclipse project.
  • 通过 STS 仪表板或 Eclipse 市场安装 Gradle Integration for Eclipse 并使用它。这符合 STS 图片并与其组件集成。
  • 安装 Buildship 项目,这是来自 Eclipse 的 Eclipse 的“官方”Gradle 集成,这应该是您选择的扩展。
  • 使用 Gradle 创建特定于 Eclipse 的项目元数据并将该项目作为现有 Eclipse 项目导入。

回答by gavenkoa

From https://github.com/eclipse/buildship/wiki/Migration-guide-from-STS-Gradle-to-Buildship

来自https://github.com/eclipse/buildship/wiki/Migration-guide-from-STS-Gradle-to-Buildship

There are two major Gradle plugins for Eclipse: one created by SpringSourceas part of the Spring Tool Suiteand one called Buildshipdeveloped by Gradle Inc. Since Buildshipbecame an eclipse.org project, the SpringSource developers are planning to phase out their tooling and switch to Buildship.

Eclipse 有两个主要的 Gradle 插件:一个由SpringSource创建,作为Spring Tool Suite 的一部分,另一个由Gradle Inc开发,称为Buildship。由于Buildship成为eclipse.org 项目,SpringSource 开发人员计划逐步淘汰他们的工具并切换到Buildship

So Buildshipis the only currently supported variant.

所以Buildship是目前唯一支持的变体。