cannot sync dependencies in a Maven project


somehow my project got disassociated from pom.xml and I can no longer sync dependencies. Is there any way to fix this without having to recreate the IDEA project from scratch?


1 comment
Comment actions Permalink

I am not sure what exactly the situation is in your case, but, assuming that your IntelliJ project was created using your POM files (with the "Automatically synchronize with maven structure on startup" selected), you should be able to open the Maven pane in your project and click the sync icon to synchronize the IntelliJ project settings with your POMs. Note: that will bring your Idea project back to the structure defined in the POM, not the other way around.

If you have created your IntelliJ project from POMs and checked ""Keep .ipr and .iml files...", then your project was indeed created from POMs but, after that, it went on its own. In other words, once the project was created, any changes you made in IntelliJ were saved in the Idea project files and became out of sync with your POMs after you had modified the project structure via Idea Settings. (I don't think IntelliJ provides an option to automatically update/create your POM files from its project files.) If that is the case, re-create your project with the "Automatically synchronize w/maven..." option this time. This will ensure that any changes you make to your POM files will be automatically reflected in your project each time you restart IntelliJ, or each time you sync by clicking the sync icon in the Maven window pane. Remember that if you are using Maven, make sure you configure you dependencies through POMs and not via IntelliJ settings. (That is, until (if ever) Jetbrains provides the functionality to reverse-sync the IDEA projects with the POM files the projects were originally created from, which would be a nice feature, I think.)

In any case, if you have your Maven files in order, creating a new IntelliJ project from them is a matter of seconds.



Please sign in to leave a comment.