The reason IntelliJ couldn't find declarations was that the subprojects were not built. After investigating why subprojects were not built, I found out that using "auto-import" was breaking the subprojects. After importing the project from build. gradle without auto-import, it worked for me.
First of all you should try File | Invalidate Caches and if it doesn't help, delete IDEA system directory. Then re-import the Maven project and see if it helps.
It means that the files exist locally, but are not in the repository, and are not scheduled for addition. With other words, the files are not under version control.
IntelliJ sometimes gets confused all by itself, even without the external changes Korgen described (though that is a good way to consistently reproduce it).
Click File -> Synchronize, and IntelliJ should see that everything is okay again.
If that doesn't work, IntelliJ's caches might be corrupt (this used to happen a lot more often than it does now); in that case, regenerate them by
Clicking File -> Invalidate Caches and restarting the IDE
(though loading the project will take a while while the caches are recreated).
I experienced this when I updated my JDK manually and removed the previous JDK
Integer
for example) and press ALT + ENTER (or click the light bulb icon)Configure
/opt/jdk1.7.0_51
instead of /opt/jdk1.7.0_65
)And everything should be back to life :)
IntelliJ sometime gets confused after importing maven projects and then changing poms externally or generating sources outside IntelliJ.
You might want to try a maven->force reimport from within intellij on the project root
I had the same problem after changing JDK from 1.6 to 1.7 in my pom.xml and setting Maven 3 path + JDK project settings to 1.7.
What did it for me was => File -> Invalidate Caches and Restart
PS: problem occured again, so i just reimported the full project after deleting the .idea folder and now it works fine as usual :)
In my case, getter and setter dependencies were coming through lombok plugin (Using java with Spring). And in the new installation of intellij idea, I had not installed the lombok plugin. Installing the lombok plugin fixed it for me.
If you're still getting this error, even after you've tried all the other suggestions on this question, you have checked all your JDK, Maven settings, invalidated cache, synchronized your workspace and restarted, but things still aren't working for you, then go to your project directory and delete the entire .idea
folder. Restart your IntelliJ; all the files under .idea
will be created freshly which reflects the current situation.
At least, this worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With