Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntellijIDEA not recognizing classes specified in Maven dependencies

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

like image 200
John Humphreys Avatar asked Feb 23 '13 23:02

John Humphreys


People also ask

Why Maven dependencies are not showing in IntelliJ?

If the dependencies weren't imported correctly (IntelliJ IDEA highlights them), try to perform the following actions: You can check your local maven repository in the Maven | Repositories settings and try to update it. You can check the jar file of the local . m2 repository to see if it was downloaded correctly.

How do I force an update dependencies in IntelliJ?

Press Ctrl + Shift + A to find actions, and input "reload", you will find the "Reload All Maven Projects". On a Mac, use ⌘ + ⇧ + A instead.


1 Answers

For some reason re-import did not do the trick. After looking at this:

http://www.jetbrains.com/idea/webhelp/maven-importing.html

I set auto-import and then the problem went away though; hopefully it helps someone else. Thanks for the ideas everyone :).

like image 93
John Humphreys Avatar answered Oct 19 '22 11:10

John Humphreys