Intellij Re-import Gradle Project

北城以北 提交于 2019-11-30 17:08:08

IntelliJ 13 supports "refreshing" the Gradle project. When the project is refreshed any dependency changes are picked up as well as any changes to the project structure.

In order to do so go to View -> Tool Windows and open the Gradle Tool Window you find the refresh button in the upper bar.

I'm using intellij 2017 and was unable to locate the "refresh" option as described in previous versions of intellij. For me,

./gradlew idea corrected the issue. gradle idea should also work.

UPDATE

As noted in the comments, when using intellij 2017 open the build.gradle file as a project and enable the "auto import" command to avoid this issue all together!

The Gradle support in IntelliJ 12 is limited. (I've heard 12.4 is somewhat better, but I don't know if it supports updating the project.) Either check out the new Gradle plugin in IntelliJ 13 (EAP), or generate IDE files using Gradle's IntelliJ plugin.

Steps that helped me:

  1. Close the project
  2. Delete ‘gradle’ and '.gradle' folders in the project root
  3. Import the project as gradle project

See images of Gradle tab before and after

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!