IntelliJ cannot find any declarations
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.
I had this same problem, and @AniaG's solution in the comments worked for me.
- Right-click
src
folder - Mark Directory as > Sources Root
I faced the same issue and spent almost 15-16 tiring hours to clean, rebuild, invalidate-cache, upgrade Idea from 16.3 to 17.2, all in vain. We have a Maven managed project and the build used to be successful but just couldn't navigate between declaration/implementations as Idea couldn't see the files.
After endlessly trying to fix this, it finally dawned to me that it's the IDEA settings causing all the headache. This is what I did (Windows system):
- Exit IDE
- Recursively delete all
.iml
files from project directory del /s /q "C:\Dev\trunk\*.iml" - Find and delete all
.idea
folders - Delete contents of the caches, index, and LocalHistory folders under
<user_home>\.IntelliJIdea2017.2\system
- Open Idea and import project ....
VOILAAAAAAAAAAAA...!! I hope this helps a poor soul in pain