Library management

The list of library dependencies under Project structure doesn't appear to be synchronized with the POM.
For example, if I replace a dependency with another that has a changed package for some classes, I
would expect to see the errors show up in the source, but they don't until I go into structure and
manually delete the old library. What is the solution? Even invalidating caches doesn't help.

1 comment
Comment actions Permalink

After changing a POM, IDEA needs to re-import (i.e. re-synchronize) the maven project. You can have IDEA set to do this automatically, or manually. Configuring to auto works fine if you only teak a POM occasionally. But I personally find Auto a bit of a hassle if doing a large edit (as it is consistently starting a re-import as I am editing I'm hoping the feature request Maven auto import should have a delay gets implemented some day.). To configure auto-import for the current project, open the Maven settings either via the settings button maven-settings.png in the maven tool window, or going to File > Settings (Ctrl+Alt+S) > [Project Settings] > Maven. On the "Importing Node", set/unset "Import Maven project automatically". If you have auto import turned off, you can import (i.e. sync) the project via the reimport button maven-reimport.png on the maven tool window. IDEA should also prompt you with a notification that the project needs to be re-imported:
If you are not seeing this, check the "Maven Import" setting in File > Settings (Ctrl+Alt+S) > [IDE Settings] > Notifications.

To configure the default "Import Maven project automatically" setting for any future new projects, set it under File > Other Settings > Default Settings > [Project Settings] > Maven > Importing.

If after reimporting, your project configs are still out of sync. Try doing a re-import 2 o3 three times in a row. If that does not resolve it, you may have to recreate your project to fix things (especially if the project library settings have been manually edited. I'm not sure how IDEA handles that situation since I never manually edit them.) In general, you will not want to (or need to) manually edit the project's library dependencies. Just edit the POM and re-import and that will keep them in sync.


Please sign in to leave a comment.