Intellij Cannot resolve symbol on import
you can try invalidating the cache and restarting intellij, in many cases it will help.
File -> Invalidate Caches/Restart
There can be multiple reasons for this. In my case it was wrong source root issue. Invalidate caches didn't work along with other solutions.
Check your module source roots.
Project Structure (Ctrl+Alt+Shift+S).
Modules
Select your problem module.
Change tab on top of window "Sources".
Remove unwanted source roots. Keep one and add src and test source roots in this root.
IntelliJ has issues in resolving the dependencies.Try the following:
- Right click on pom.xml -> Maven -> Reimport
- Again Right click on pom.xml -> Maven -> Generate sources and update folders