Intellij Re-import Gradle Project

前端 未结 6 1507
予麋鹿
予麋鹿 2021-01-03 20:24

I just added a new test source directory to my Gradle project and want IntelliJ to recognize it. I can close the project and reopen the build.gradle file and ch

相关标签:
6条回答
  • 2021-01-03 20:32

    Right click on the build.gradle file and select import gradle project

    0 讨论(0)
  • 2021-01-03 20:46

    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!

    0 讨论(0)
  • 2021-01-03 20:47

    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.

    0 讨论(0)
  • 2021-01-03 20:52

    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

    0 讨论(0)
  • 2021-01-03 20:54

    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.

    0 讨论(0)
  • 2021-01-03 20:56

    For IntelliJ 2020, right-click the build.gradle file and press the Import Gradle Project option. This will let IntelliJ know it's a Gradle project and be able to interpret it.

    0 讨论(0)
提交回复
热议问题