How to add new modules to a Maven project?

Hi all,

Just wondering: what is the best way to add new maven modules to an existing IntelliJ project?

Erik

PS: I just did it the way I thought it worked, and now only the new project is visible, the others I gone. This is not the first time this happens, so I must be doing something wrong.... :(

7 comments
Comment actions Permalink

IIRC you can "Open Project" (selecting a pom.xml as the project) and then choose to add the imported modules in the current project.

Edit : I just did it, the steps are "New Project" > Import from external model > Maven + select Import into current project

Edited by: Thibaut on Jun 10, 2008 2:57 PM

0
Comment actions Permalink

Well, I did that, but IntelliJ just keeps asking me to remove the other modules, and I have no idea on how to prevent that..

0
Comment actions Permalink

if you're gonna work with those different modules for a while, I'd suggest creating an ad hoc pom aggregatiing all the poms you're interesting in as sub modules

0
Comment actions Permalink

Thanks for the tip, though it sounds a bit like a workaround for the problem in IntelliJ! Actually, I already have something like the thing you proposed. I have one uber-pom-to-rule-them-all, which contains 4 other projects.

To give you an idea, this is my project structure:


So, I have 3 'loose' projects, and one uberpom with multiple parent projects in it, and each parent project contains the submodules.

But my problem is, that if I'm going to check out a new module from SVN, and I'm going to add it to the project (by using the new project menu item, which I still think is very strange) by using the 'import project from external model', selecting 'maven', and checking 'import into current project', IntelliJ will always ask me to remove all the modules listed above! This happened to me 20 times already, and I was hoping the new EAP would fix it, but unfortunately, it doesn't

0
Comment actions Permalink

The idea behind my suggestion is to have a pom that materializes your "workspace" (from eclipse vocabulary).

So if you want to add a new maven project to your workspace, add it as a submodule in your workspace pom, rather than using IDEA New project's feature.

I agree though that IDEA may need to be able to open multiple Maven root projects at the same time in the same window, although then you may also ask being able to open multiple iprs I guess ? Not sure where we'd be going :)

0
Comment actions Permalink

Last 8.0 eap has Add and Remove pom actions on the Maven Projects view.
With these action you may add any pom to the currently managed Maven projects or remove unnecessary one.
Next 7.0.4 eap will have these action too.

As for problem with the 'import into the current project' option, I'll check it.

Edited by: Anton Makeev on Jun 11, 2008 3:39 PM

0
Comment actions Permalink

Sounds interesting! I'll check it out when you release it!

0

Please sign in to leave a comment.