导入 Gradle 项目
若无 Gradle 插件
如果要在Eclipse中导入Gradle项目,需要在build.gradle中加入apply plugin: “eclipse”,然后运行如下命令:
cd myProject/
gradle eclipse
gradle eclipse
执行gradle eclipse命令后,会生成名为.project、.classpath、.setttings的文件及目录,然后就可以在Eclipse中导入该项目。
如果在 Eclipse 中,如果有 Gradle 插件,可以直接导入项目,就不需要像上面那样初始化了。
若有 Gradle 插件
在 Eclipse 的 Marketplace 中搜索 Gradle,并安装如下插件:
如果Eclipse中安装了Gradle插件,可以直接导入Gradle项目。
File -> Import -> Gradle -> Existing Gradle Project ,如下截图:
参考文献
Gradle/The Eclipse Plugins
CSDN/Eclipse + Gradle环境配置
Using the Gradle build system in the Eclipse IDE – Tutorial
Import existing Gradle Git project into Eclipse