IntelliJ cannot find any declarations

Andy picture Andy · May 17, 2016 · Viewed 113.2k times · Source

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.

Answer

Thomas picture Thomas · Aug 24, 2016

I had this same problem, and @AniaG's solution in the comments worked for me.

  • Right-click src folder
  • Mark Directory as > Sources Root

enter image description here