[Solution] IntelliJ: Cannot find declaration to go to, Nothing here, Java file outside of source root Errors


Cannot find declaration to go to IntelliJ

If you are trying to access a class and its member variables and methods in IntelliJ IDE for an external dependency (be it Maven or Gradle) you may see a tooltip saying "Cannot find declaration to go to" if the source of the class is not available.

Java file outside of source root

If you hover over your class if you see "Java file outside of source root" and when you try to run the main method you would not be able to run the application with a message "Nothing here"

Solution:

Open installed Plugins (press Shift key twice) and disable Gradle and restart IntelliJ, you will be prompted to enable Gradle, once dependencies and their source are downloaded and the build is complete, this error should be fixed.


🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.

Follow Us: GitHub | Facebook | Twitter | Instagram