tags:

views:

60

answers:

2

I have some related legacy projects that are a mess and I would like to mavenize them as a multi-module project shared on subversion (first multi-module project, we've always had them separate). There are a few key parts 1) webservice, 2) model, 3) various swing clients, 4) model (w/ persistence from hibernate), 5) core JSE tasks.

I've been messing around for a few days trying to correctly set it up using Eclipse (Helios), Maven (2.2.1), m2eclipse (0.10.0) and Subversion (1.6) for our team. I keep stumping myself or having random errors that force me to backtrack. I'm hoping someone can help me out with some best practices.

Here are some of the questions:

m2eclipse requires a "flat" eclipse project structure. Does that mean I should create a subversion repository for each module? If I do one repository and try to check in from the parent project I'm having a difficult time setting the svn:ignore property on the nested project target (and other) directories.

If I do a module per repository, I seem to be able to check them in ok. The question then is what is the best way to check out via subclipse? Is there a best order? Parent or child project(s) first? Do I need to checkout the parent project and modify the checkout path of the children project to be nested in the file directory that will allow me to then "clean install" from the parent project?

Or, should I abandon subclipse and m2eclipse and checkout and run my maven goals from the command line.

Or, should I just being using the SCM integration with Maven. Or, maybe just not even try to get a multi-module project setup.

What do others do? Does anyone have some documentation (I missed) or some links (Google didn't recommend)?

Thanks in advance for your feedback.

A: 

It is a bit tricky at first. The way I've typically seen it setup is like so:

In subversion:

- Parent Project
-- Module A
--- pom.xml (module A)
-- Module B
--- pom.xml (module B)
-- Module c
--- pom.xml (module C)
-- pom.xml (parent project)

Some things to note (you already know):

  • You have to have the child projects listed as modules in your parent project
  • You have to list the parent project in your child pom's (as the parent group, artifact, version)
  • When you check out the project from svn, you need to do 'check out as maven project' instead of the standard 'check out' (this one can be a gotcha)

I hope this helps.

javamonkey79
A: 

m2eclipse requires a "flat" eclipse project structure.

Hmm, m2eclipse supports nested projects AFAIK (or at least importing a nested project structure). I don't use Eclipse wizards to create my projects though so maybe I'm not aware of something.

Does that mean I should create a subversion repository for each module?

No, no, absolutely not and I wouldn't do that (this will be hard to maintain). However, depending on your projects release cycles, you might have to think about the layout of your repository (single vs multiple trunk/tags/branches), especially if you plan to use the maven release plugin. If some pieces have independent release cycles, then I'd go for several trunk/tags/branches. If you always release them all together (as a single product), then a single trunk/tags/branches should do it. I wrote several answers on the topic that may be of interest:

If I do one repository and try to check in from the parent project I'm having a difficult time setting the svn:ignore property on the nested project target (and other) directories.

What is the particular problem?

If I do a module per repository, I seem to be able to check them in ok. The question then is what is the best way to check out via subclipse? Is there a best order? Parent or child project(s) first? Do I need to checkout the parent project and modify the checkout path of the children project to be nested in the file directory that will allow me to then "clean install" from the parent project?

Whatever choice you'll make (multiple repositories or not, multiple trunk/tags/branches or not), it should be possible to checkout the whole project structure in one time (using svn:externals if required). At least, you should try to make it possible (and it is, see the links posted above).

But I repeat, I do not recommend using multiple repositories (unless you want independent revision numbers) and nothing forces you to do that.

Or, should I abandon subclipse and m2eclipse and checkout and run my maven goals from the command line.

I use Eclipse, m2eclipse, subclipse successfully, all well integrated (at least for the build and "check in" part). But I do the initial import and the initial checkout on the command line and then imported

Or, should I just being using the SCM integration with Maven.

I don't use it, I don't have the need for it.

Or, maybe just not even try to get a multi-module project setup.

There is no reason to forbid the use of a multi-modules project setup, multi-modules builds are one of the key part of Maven.

What do others do? Does anyone have some documentation (I missed) or some links (Google didn't recommend)?

Have a look at the links I posted :)

Pascal Thivent
@Pascal - Thanks! I'll check those links. If I share the parent project I can successfully svn:ignore the target, .settings, .classpath, etc, all in the parent project. The children projects all have the svn:ignore grayed out. After tinkering with it, the only way I can svn:ignore the children projects is to do a full commit of the parent project, then delete the directories in the children projects I want to ignore, then commit, then the svn:ignore option is available and i can ignore them for future commits. Have you noticed that as well? Thanks again for your informative response.
chadmaughan