Wednesday, September 22, 2010

IntelliJ 9 does not recognize Maven 2 dependencies

I created a Maven 2 project from existing source and POM.xml using the wizard in IntelliJ 9. I was able to run Maven goals like Install from within the IDE after setting the M2_HOME in the project -> maven settings.

However, the dependencies were not resolved in the IDE i.e. I saw all of the imports and classes and annotations with red squigly lines in the editor.

Turns out you have to delete module named Main that was auto-created for you by the wizard, the modules from the POM files were good but the ones created by the Wizard with names like Main and Main-1 were not needed. Once deleted, everything resolved fine.