Java – IntellijIDEA not recognizing classes specified in Maven dependencies

intellij-ideajavamaven

I have a project in IntellijIDEA which was created with Maven. I then specified a set of dependencies and external repositories in the Pom.xml file.

The project builds fine on command line if I do "mvn install". When I open any of the code files in the IDE though it says all the classes handled by Maven dependencies aren't recognized – as it would for a normal project if I never added the required JARs to the build path.

I know in my Eclipse Maven projects (rather than IntelliJ) it usually shows an extra directory on the left which says "Maven Dependencies" and lists the JARs pulled in via maven. I don't see that here. What am I doing wrong?


Here's what my screen looks like:

IDE Image

Best Answer

After installing IntelliJ IDEA on a new computer I found myself with the same issue.

I had to update the remote maven repository. (Settings > Maven > Repositories)

enter image description here

Both local and remote repos needed to be updated. The remote one wasn't updated ever before this. After a restart everything worked fine. You might have to reimport your project.