Search code examples
eclipsesvnmavensubversivem2e

How do I import a multi module Maven project from SVN into Eclipse (Indigo) so that child modules can be built independently?


I have tried posting this question on the Eclipse Maven forums but it seems very quiet there so here goes...

My setup: -Eclipse Indigo Java EE bundle -m2e -Subversive

We have a fairly simple multi module maven project on our repo. It has a parent project/pom and 3 child projects/poms.

Steps I am taking to import: 1) I import the project by using "import->import->->Maven->Check out Maven Projects from SCM".

2) On the next dialogue box I select svn as the SCM URL type and enter the rest of the repo URL. I leave the check boxes checked for "Checkout Head Revision" and "Checkout all Projects" and under "advanced" I leave the check box "Resolve Workspace Conflicts" checked too. I do not enter anything under "Profiles" or "Name Template".

3) On the next dialogue box I leave "Use default Workspace location" checked and leave "Add projects(s) to Working set" unchecked and click "finish".

4) I wait a minute or so for the next dialogue box to appear. It asks me to select maven projects and has a file structure as it should be-parent project/pom and 3 child projects/poms with a checkbox beside all 4 items. I have tried to select either just the parent, just the children or all 4 without success.

5) When I select just the parent and uncheck the children above, the project appears to be imported. The parent appears in the project explorer and the three children appear as sub-folders of the parent with each having a pom.

6) If I right click on the parent, I get a Maven item in the context menu and indeed I can "run as->Maven build, install etc.." ON THE PARENT ONLY. The Child projects have no such Maven context menus nor the ability to "run as->Maven x".

If I try to import all 4 projects in step 4 above, it imports with the same structure as outlined in 5 above but with the children appearing additionally as separate "independent" Maven projects (with errors).

Ultimately I just want to import the multi-module Maven project and be able to deploy it on my Eclipse Tomcat installation, so if I change a file in one of the child projects (called frontend) the change will be deployed quickly and I can check the effect out in a browser.

Thank you very much for any and all help with this issue! I am happy to answer any further questions to help trouble shoot the problem.


Solution

  • I probably explained the problem poorly in my initial question. The main problem was that I was not able to deploy the webapp component of the multi-module maven project to Tomcat. I was making a couple of basic errors:

    • I was importing the parent project without selecting the children, assuming Maven would get them all and that would suffice, but it did not: I had to select the parent and all children when importing as Maven project from svn.

    • I then failed to convert the webapp part of the project to a faceted type, and further failed to select "dynamic web app". I needed (according to a colleague) to then select version 2.5 to avoid incompatibilities with older servlet containers. (not sure how relevant this is to Tomcat 6, which is what I use).

    Once this was done I had the parent project and 3 subfolders and also the 3 child projects in their own right appearing in the project explorer (but on file system they all exist under the parent project, as it should be). I could then right click on the webapp module (the eclipse project explorer project, not the subfolder) and run as Maven project (clean, build etc.).

    I could then right click and "run on server". I had an error upon publishing about various files being out of sync. I just refreshed the child projects in eclipse and then they would publish successfully.

    Eclipse has so many versions, with so many incompatible plugins etc. that it gets confusing very quickly-lots of the tutorials are highly specific to particular versions etc.

    Thanks for helping anyway guys.