IntelliJ cannot find any declarations

We Are Going To Discuss About IntelliJ cannot find any declarations. So lets Start this Java Article.

IntelliJ cannot find any declarations

  1. IntelliJ cannot find any declarations

    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.

  2. IntelliJ cannot find any declarations

    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.

Solution 1

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

Original Author Thomas Of This Content

Solution 2

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):

  1. Exit IDE
  2. Recursively delete all .iml files from project directory del /s /q “C:\Dev\trunk\*.iml”
  3. Find and delete all .idea folders
  4. Delete contents of the caches, index, and LocalHistory folders under <user_home>\.IntelliJIdea2017.2\system
  5. Open Idea and import project ….

VOILAAAAAAAAAAAA…!!
I hope this helps a poor soul in pain

Original Author DennisLi Of This Content

Solution 3

Had the same problem. But only on my own methods.

Just fixed it by invalidating cache: (File-> Invalidate Caches/Restart)

Original Author notihs Of This Content

Solution 4

I had the same issue with idea and I was trying to open a maven project but the pom files where not identified. So right clicking on the pom file and choosing “add as maven project” did all the magic for me 🙂

Original Author Pavithra Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

Siddharth

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment