I just installed and re-installed IntelliJ. Every Java file is coming up RED. I checked the JDK; it is at 1.6.##. The maven clean install
build worked just fine
I was trying to use all the advices above, but unfortunately no one helped me. So finally I've decided to delete my intelij workspace and create the new one - it helped :) But earlier I was also doing cleaning the cache, reimporting maven projects, cleaning projects and rebuilding them.
This is if you see Java classes in red and get this error, "Cannot resolve symbol".
If you're importing projects into IntelliJ and none of the above solutions worked for you then give this a try. This is what worked for me when everything else failed.
Go to to your project folder and rename/delete the .idea folder which has the idea settings for your project. This would have been created from your old IntelliJ version. Once you have renamed/deleted the .idea folder, import your project into IntelliJ. You should not see any errors for your Java classes now. Hope this helped.
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.
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 :)
For 2020.1.4 Ultimate edition, I had to do the following
View -> Maven -> Generate Sources and Update Folders For all Projects
The issue for me was the libraries were not getting populated with mvn -U clean install
from the terminal.
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