IntelliJ cannot find any declarations

2019-03-08 00:24发布

I completely uninstalled IntelliJ and have now reinstalled and imported my project. I imported using gradle and can see all of the files in my project present. However, when I open a file I can't find any declaration to go to by doing cmd + click. I have the Java 7 SDK setup, and I can't even go to the declaration of classes in my own project. Going to a Java core class like String or List doesn't work either. How can I enable the IDE to be able to find my classes?

I'm on OSX Yosemite, IntelliJ 2016.1.2 build 145.972.

15条回答
劳资没心,怎么记你
2楼-- · 2019-03-08 00:52

I found this cannot find declaration to go to problem once in my Maven project. The reason for this was just that one of the sub-projects in my project did not import as maven project correctly.

查看更多
太酷不给撩
3楼-- · 2019-03-08 00:52

For what its worth, in Pycharm it is: Right click on the root folder->Mark Directory as-> Sources Root

查看更多
爱情/是我丢掉的垃圾
4楼-- · 2019-03-08 00:53

IDEA may ignore some of your maven dependency files. The "External Libraries" node in your project structure might be empty or incomplete.

Go to:

  1. IntelliJ --> Preferences
  2. Search for Maven [on the left tab] -> Ignored Files
  3. See if there is any path on the right side that is checked(ignored) and uncheck that.enter image description here
查看更多
登录 后发表回答