Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-users] multimodule setup

See inline
On 10/09/2011 07:17 PM, Steve Cohen wrote:
Thanks, Rafał.

Why do you say it's less hassle the flat way? Is that because of version control, or what?
It's just the way Eclipse does things, and you don't need to deal with things showing up multiple time in search and team/synchronize views.

When you say, "Maven's native layout" what does that mean? Is there some particular archetype that creates it for you that way, or what?

If you look at the sources of Maven itself, or other software created by the people behind maven, you'll find that module hierarchy corresponds to directory nesting. Historically, some maven plugins (most notably release and site plugins) made assumptions about the physical layout of modules and didn't work properly with flat layout. Recent versions of release plugin can work with both, I don't know about site plugin because I haven't used it for many years, but I suspect that it was taken care of too.

I wound up taking a few hours of frantically trying this and trying that, coming up with something that worked, without fully understanding what I was doing (I suspect I was taking advantage of Eclipse functionality that might not be repeatable outside of Eclipse) and wound up with a layout in between your Eclipse and Maven models (everything flat under the parent - only 1 level of nesting):

-parent pom
  -ear
  -war 1
  -war 2
  -utilty jar 1

I'd really like to come up with a standard methodology that works and that I understand, so thanks for your help. It bothers me that I don't fully understand what I just did.

This layout can be converted into completely flat layout easily. You need to modify the children POMs to reference the parent POM like this:
<parent>
<relativePath>../parent pom</relativePath>
</parent>
And modify the modules section of the parent POM acordingly:
<modules>
<module>../ear</module>
  ...
</module>
At some point maybe even convert the methodology into an archetype that would be repeatable, but that is currently beyond my skill set. I have no idea how archetypes are created.

You start with capturing an existing module structure: http://maven.apache.org/archetype/maven-archetype-plugin/create-from-project-mojo.html And then you clean it up and tweak it until you're happy with it. But first you need to get your prototype project working :)

Cheers,
Rafał
Steve


On 10/08/2011 04:38 PM, Rafał Krzewski wrote:
The "native" module layout in Eclipse is flat

-parent pom
-ear
-war 1
-war 2
-utilty jar 1
...

Maven's native layout is nested

-parent pom
  -ear
    -war
    -war
    -utilty jar 1
...

In my opinion flat layout is less hassle, but m2e can handle both. For
nested structure, you may want to use 'hide folders of physically nested
modules' option - otherwise same files will appear in search results
multiple times.

Cheers,
Rafał

On 10/08/2011 07:19 PM, Steve Cohen wrote:
I want to create the following in m2e:
An EAR containing two wars that will run on JBoss 5.1. One of these
wars implements a Web Service but that probably is irrelevant to my
concerns here. My question is simpler.

What is the best way to organize the packages?

A main multi-module project?
Let the EAR project own the two wars?

What archetypes? I am running myself silly over what conceptually is
simple.
_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-users

_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-users

_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-users



Back to the top