Maven project question

There may be a way to do this, but I just can't seem to find it.

My company uses a standardized model for how we set up our maven projects. Each "project" has a core, parent, and webapp module. While the artifactId and directory names are the same, they have different group names.

I'd like to be able to make an IntelliJ project which contains 2 or 3 of these maven projects. To do this, I create a new project by importing from external model (maven), then doing the same thing again and importing into the same project.

The only trouble is that IntelliJ doesn't seem to like having two modules with the same name. When I try to start up the project after closing the project I get an error message telling me that "these modules have been removed from the maven structure: 'parent', 'core', 'webapp' Do you want them to be removed from the project too?"

Things go downhill from here. Either I tell it no and both directories end up in a single core, webapp, or parent module; or one set of the modules get deleted. Either way the modules don't retain the right dependency setup.

Does anybody have a similar setup and a way to work around it? I'm working with multiple project right now, but that doesn't work very well for refactoring. :(

Thanks,
Matt

Edited by: Matthew Flower on Sep 5, 2008 2:00 PM

4 comments
Comment actions Permalink

I have a workaround, or at least a partial one. If you are using a unix-like operating system, create a directory that has soft-links to all of the projects that you want to add. Something like this:

ijworkspace/
project1 --> ../../a/b/c/project1
project2 --> ../../d/e/f/project2

Then create a new intellij project that looks at the "ijworkspace" directory and which does the aggressive search for maven projects.

I say this is a partial workaround because of one main downside -- adding another maven project gives my original behavior once you close and re-enter the intellij project. Also, later versions of windows do have softlinks, but they are tough to create.

Any other ideas?

0
Comment actions Permalink

you should be able to simply create a pom for your 'workspace' defining your 3 projects as submodule, and then open this project using IDEA

0
Comment actions Permalink

you should be able to simply create a pom for your 'workspace' defining your 3 projects as submodule, and then open this project using IDEA

+1. Exactly! I do this all the time. make sure you define the packaging type as "pom" for the "wrapper" project. Something like this:


4.0.0 com.yourcompany yourproject pom 1.0-SNAPSHOT My Workspace This project combines all my webapp modules http://maven.apache.org my-webapp1 my-webapp2 my-webapp3 ... ... org.apache.maven.plugins maven-compiler-plugin 1.6 1.6 ]]>

0
Comment actions Permalink

I've only been using it for a few minutes and the solution that you guys suggested is already working considerably better than what I've been trying to do up until now.

In case anyone else looks at this thread, ignore my idea above -- modules tend to get "lost" that way.

Thanks to both of you for your help.

-m

0

Please sign in to leave a comment.