Not all Maven dependencies appear in "External libraries"


Hello folks.

This is a problem I have been experiencing for a while. Each time a new version of IntelliJ is release I think "hopefully this will fix it" but they never do :p

So, I have something like this:

This happens with many libraries. All those libraries are in the main repo and if I run mvn clean install from the command line it works fine. I mean, this is an IntelliJ problem, not something wrong with Maven and its dependencies.

Is there a way to make it work? Something like clearing some intellij-maven cache or forcing the import (doing Maven -> Reimport does not work). This is driving me nuts :(

Comment actions Permalink

It's most likely an incomplete or corrupted index.

Assuming you have done a reimport of the project via the import button on the maven tool window, you can try the following:

1st option:
1) go to File > settings > Maven > repositories
2) In the  top pane, where it says "Indexed Maven Repositories", select your local repository and click the update button. This will update the indexing of your local repo. Wait for it to finish.
3) reimport the maven project via the import button on the maven tool window.

2nd option:
If that does not work, try invalidating your caches via File > Invalidate caches and then restart IDEA. I know that that invalidates project caches, but I'm not sure about the Maven caches. But give it a try.

3rd option:
If that does not work, here's a more drastic approach that will resolve any potential corruption.
1) Close idea
2) Go to IDEA's configuration directory (the .IntelliJIdea directory, usually  in your home directory). Inside it is the "system" directory.  In the system directory is a "maven" directory. Move or delete the "maven" directory. It has all the indexes and caches in it.
3) Restart IDEA
4) Wait for IDEA to reindex the maven repository (watch it into status bar or open the background tasks to watch it.)
5) when it's done reindexing, reimport the maven project by Clicking the import button in the maven tool window.

Comment actions Permalink

This worked for me:

File > settings > Maven > Automatically Import Maven Projects

File > Invalidate Caches and Restart 

Then just let Intellij import as maven project

Comment actions Permalink

I also had this problem, I tried everything mentioned here, but they did not work!! the issue was that in maven projects section, my maven projects were ignored for some reason!!So I just right clicked on each project and clicked unignore project!!after that I did everything mentioned here and it worked

Comment actions Permalink

@Jmeen011 Your answer worked for me, I simply had to do invalidate caches and restart for intelliJ to reinsert all my dependencies. Thanks 

Comment actions Permalink

@Elham's answer was my solution. Check the Maven tool window to see if the module is grayed out. If it is, you're ignoring it. Right click and choose Unignore Projects. 

Comment actions Permalink

I closed Intellij IDE and deleted .idea folder in the project root and restarted the IDE. It worked! 


Please sign in to leave a comment.