Skip to main content

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

See my comments inline

And no there shouldn't be any difference between
2011/10/10 Steve Cohen <scohen@xxxxxxxxxxxxxxx>
Thanks, Fred.
This suggestion mostly worked - except for these minor annoyances:
Ok that's a good start :-)
 
1.  The archetype names the modules something other than what I wanted,
rootname-ear (ok), rootname-ejb(no), rootname-web(no).
Customizing proved to be a pain.  It is certainly not enough to rename the project, there are references all over the place and I couldn't get it to work.  Gave up on this.
You should use the Refactor > Rename Maven Artifact menu. It will propagate the module rename, but will keep the name of the physical folder.
In that case, you should delete the maven project from eclipse (not physically), do a manual rename of the folder (and the <module> in the parent pom.xml), then reimport as a maven project.

Instead, recreated with the archetype and just added modules with the names I wanted, planning to delete later the unneeded modules.

2.  Even though everything now works the way I want it to application-wise, there are two Eclipse problems:

1) The "Hide Folders of Physically Nested Modules" has no effect. Eclipse shows me a flat structure that does not mirror the actual structure of the file system which is nested, no matter which way the setting is set.

Even though the physical structure of your project uses nested folders, Eclipse is only capable of rendering a flat view of your projects. Nothing you can do about it so far.
  
2) Strangest of all, under the parent module, I see subfolders for the two new modules I added, but not the other modules that the archetype created.  This behavior, too, is unaffected by the "Hide Folders of Physically Nested Modules" setting.  And yet, I can see nothing in the configuration of either the parent or child projects that would indicate to me anything different between the archetype-generated modules and the ones I added, either the maven files or any of the eclipse settings and .project files.
"hide folders of physically nested modules" is an experimental feature that works only on project import (or when creating projects from archetypes). Its experimental status shouldn't change anytime soon, as Igor stated in http://dev.eclipse.org/mhonarc/lists/m2e-users/msg01316.html
 
Incidentally, is there any difference between
New Project -> Maven Module
and
Maven -> New Module Project
?

No
 
The latter was how I added my new modules.



On 10/09/2011 01:03 PM, Fred Bricon wrote:
You can try the multi-javaee5-archetype from
http://code.google.com/p/open-archetypes/. It gives you a nested
multi-module setup with parent pom, ear, war, ejb and utility projects.
If you want to add a 2nd war project, just create  new project>  maven
module when selecting the parent pom. Then add it as a dependency to the ear
project

HIH

Fred Bricon

2011/10/9 Rafał Krzewski<Rafal.Krzewski@caltha.pl>

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<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<https://dev.eclipse.org/mailman/listinfo/m2e-users>


______________________________**_________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/**mailman/listinfo/m2e-users<https://dev.eclipse.org/mailman/listinfo/m2e-users>


______________________________**_________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/**mailman/listinfo/m2e-users<https://dev.eclipse.org/mailman/listinfo/m2e-users>


______________________________**_________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/**mailman/listinfo/m2e-users<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



--
"Have you tried turning it off and on again" - The IT Crowd

Back to the top