This problem happens intermittently for different libraries and different projects. When trying to import a library, the package will be recognized, but the class name can\'
Run this command in your project console:
mvn idea:idea
Done. Had this issue many times. Tried 'Invalidate Cache & Restart' and all other solutions. Running that command works perfect to me. I'm currently using IntelliJ 2019.2, but this also happened in previous versions and solution worked as well.