Intellij IDEA和Gradle项目 [英] Intellij IDEA and Gradle projects

查看:222
本文介绍了Intellij IDEA和Gradle项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个新项目。我应该在 build.gradle 中放置 apply plugin:'idea'并运行 $ gradle idea ?还是应该将gradle项目直接导入IntelliJ IDEA 14.1?哪一个允许我将依赖关系添加到 build.gradle 并让IDEA自动下载&了解它们?

解决方案

使用Intellij 14,您可以打开 build.gradle 使用Intellij的文件 - >打开的文件。这将导入gradle项目,包括所有依赖项。
更改 build.gradle 文件中的内容后,您可以点击gradle工具窗口顶部的刷新所有gradle项目。



您也可以在设置的工具/ Gradle 标签下标记使用自动导入。这将在您每次刷新项目时自动解决对gradle项目所做的所有更改。



插件是将Gradle项目导入Intellij的旧方法。
使用新版本的Intellij,它变得多余。


I have a new project. Should I place apply plugin: 'idea' in build.gradle and run $ gradle idea? Or should I import the gradle project directly into IntelliJ IDEA 14.1? Which one will allow me to add dependencies to build.gradle and have IDEA automatically download & know about them?

解决方案

With Intellij 14 you can just open the the build.gradle file using Intellij's File --> Open. this will import the gradle project, including all dependencies. After you change something in the build.gradle file, you can click on "refresh all gradle projects" at the top of the gradle tool window.

You may also mark "use auto-import" under the Build Tools/Gradle tab in Settings. This will resolve all changes made to the gradle project automatically every time you refresh your project.

The idea plugin is the old method of importing a gradle project into Intellij. With the newer versions of Intellij, it has become redundant.

这篇关于Intellij IDEA和Gradle项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆