You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Andrew Hughes <ah...@gmail.com> on 2008/02/24 23:46:09 UTC

Multi-Module Hierarchy : Eclipse vs Maven Plugins

Greetings All,

I've been part of a team of happy Eclipse & Ant+(Some 'Glue') developer for
many years, from which I now have replaced the Ant+(Some 'Glue') with
maven..... I couldn't find any comprehensive articles on this, hence the
email:

The default eclipse "flat" project structure is in direct contradiction to
the default maven "hierarchy" structure. This seems to lead to the situation
where "you're damned if you do, and damned if you don't".

Firstly, when you stick with the default maven "hierarchy" structure all
sorts of things automagically just work! Please don't pretend they all work
with "flat"/"other" structure, they don't. No one can even speak on behalf
of ALL plugin's and claim they do work. But, there's an awful lot of awesome
"only works with default hierarchy" maven plugin's and tools because they
make this simple assumption. The real problem is that these "awesome"
plugins and tools are so valuable to development that you really really
really should stick with the default maven "hierarchy" structure!

On the inverse: Eclipse has been around for many years. It's comprised of
some pretty awesome plugin's, tools yadda yadda yadda.... please don't say
use netbeans or IDEA they're not the issue here. Eclipse does the opposite
to maven, it expects a "flat" project structure.... and just like the Maven
plugin's, if you deviate from this you start discarding awesome features
within eclipse that you would consider mandatory for your development
environment.

One of the major problems with eclipse (and is not addressed on the maven
website), is how a "hierarchy" structure works with your SCM (cvs or svn).
This is something most would say is mandatory! If you checkout the parent,
then you also checkout the modules contained within it. Then if you say "ok
lets check out the modules now"... then you break the structure.

The bottom line is that eclipse can't cope with specifically with the
"parent" and "heirarchy" strucutre. You must checkout the whole parent with
command line (or a different IDE) and mvn install the parent to the local
repo.. then work on each module individually checked out in isolation.

Unless someone can explain how I can checkout a parent with modules.. see
each project (inc parent) as an eclipse project and run the parent goals
inside the IDE.. then the best solution for eclipse & maven is. Hierarchy
and complex/manual eclipse usage.

Re: Multi-Module Hierarchy : Eclipse vs Maven Plugins

Posted by Siarhei Dudzin <si...@gmail.com>.
Just FYI, Eclipse 3.3 does support hierarchical project layout.

Siarhei

On Mon, Feb 25, 2008 at 7:52 AM, Andrew Hughes <ah...@gmail.com> wrote:

> Thanks Graham!
>
> I works this out just as I got your email :)
>
> To explain this to others... taking a multi module maven project either
> out
> of svn/cvs (Q: outside eclipse only?) or creating one from scratch leaves
> you with a skeleton Maven project. With no eclipse
> .project/.classpath/.whatever files in the project, it can then be made
> "eclipse complient" with the "mvn eclipse:eclipse" command on the project
> parent.  From this point onwards, the project source now contains all the
> Maven Information, Eclipse Information, and possibly svn/cvs.
>
> Now that you have content to import, you can "Import Existing Projects ->
> Maven Project" into Eclipse. With it will come the Maven, Eclipse and
> possibly svn/cvs information. The parent appears in the project list, as
> do
> the modules.
>
> I only have these closing questions/clarification...
>
> Performing checkout's outside the IDE, then running "mvn eclipse:eclipse",
> then  importing is a bit of a pain.... to "get around this" would people
> (arguably no doubt) checkin the mvn eclipse:eclipse configuration into
> svn/cvs once generated? Or is it possible to checkout a parent, then run
> eclipse:eclipse within the IDE?
>
>
> Thanks again,
> Andrew
>
>
> On Mon, Feb 25, 2008 at 9:52 AM, Graham Leggett <mi...@sharp.fm> wrote:
>
> > Andrew Hughes wrote:
> >
> > > The bottom line is that eclipse can't cope with specifically with the
> > > "parent" and "heirarchy" strucutre. You must checkout the whole parent
> > with
> > > command line (or a different IDE) and mvn install the parent to the
> > local
> > > repo..
> >
> > Yep, not too far beyond most developers at this point...
> >
> > > then work on each module individually checked out in isolation.
> >
> > Why?
> >
> > Just run "mvn eclipse:eclipse" in the root of your multimodule project,
> > and then tell eclipse to "import existing projects" starting at the root
> > of the multi module project.
> >
> > Eclipse will import all projects regardless of any weird directory
> > structure you (or maven) might have imposed, and you can switch between
> > the projects at will, and have all of them loaded at once.
> >
> > Maven sets up all the eclipse projects in a multimodule build so that
> > each project depends directly on each other project in eclipse (as
> > opposed to modules depending on the final jar of another module). This
> > removes the need to run "mvn install" on one module before changes to it
> > are visible to other modules in the multimodule project.
> >
> > Yes, the original checkout will need to be done outside of eclipse using
> > a normal scm tool, but that's not beyond the skills of a developer is
> it?
> >
> > Regards,
> > Graham
> > --
> >
>

Re: Multi-Module Hierarchy : Eclipse vs Maven Plugins

Posted by Marcelo Alcantara <ma...@gmail.com>.
Great topic. Thanks.

On Mon, Feb 25, 2008 at 3:52 AM, Andrew Hughes <ah...@gmail.com> wrote:

> Thanks Graham!
>
> I works this out just as I got your email :)
>
> To explain this to others... taking a multi module maven project either
> out
> of svn/cvs (Q: outside eclipse only?) or creating one from scratch leaves
> you with a skeleton Maven project. With no eclipse
> .project/.classpath/.whatever files in the project, it can then be made
> "eclipse complient" with the "mvn eclipse:eclipse" command on the project
> parent.  From this point onwards, the project source now contains all the
> Maven Information, Eclipse Information, and possibly svn/cvs.
>
> Now that you have content to import, you can "Import Existing Projects ->
> Maven Project" into Eclipse. With it will come the Maven, Eclipse and
> possibly svn/cvs information. The parent appears in the project list, as
> do
> the modules.
>
> I only have these closing questions/clarification...
>
> Performing checkout's outside the IDE, then running "mvn eclipse:eclipse",
> then  importing is a bit of a pain.... to "get around this" would people
> (arguably no doubt) checkin the mvn eclipse:eclipse configuration into
> svn/cvs once generated? Or is it possible to checkout a parent, then run
> eclipse:eclipse within the IDE?
>
>
> Thanks again,
> Andrew
>
>
> On Mon, Feb 25, 2008 at 9:52 AM, Graham Leggett <mi...@sharp.fm> wrote:
>
> > Andrew Hughes wrote:
> >
> > > The bottom line is that eclipse can't cope with specifically with the
> > > "parent" and "heirarchy" strucutre. You must checkout the whole parent
> > with
> > > command line (or a different IDE) and mvn install the parent to the
> > local
> > > repo..
> >
> > Yep, not too far beyond most developers at this point...
> >
> > > then work on each module individually checked out in isolation.
> >
> > Why?
> >
> > Just run "mvn eclipse:eclipse" in the root of your multimodule project,
> > and then tell eclipse to "import existing projects" starting at the root
> > of the multi module project.
> >
> > Eclipse will import all projects regardless of any weird directory
> > structure you (or maven) might have imposed, and you can switch between
> > the projects at will, and have all of them loaded at once.
> >
> > Maven sets up all the eclipse projects in a multimodule build so that
> > each project depends directly on each other project in eclipse (as
> > opposed to modules depending on the final jar of another module). This
> > removes the need to run "mvn install" on one module before changes to it
> > are visible to other modules in the multimodule project.
> >
> > Yes, the original checkout will need to be done outside of eclipse using
> > a normal scm tool, but that's not beyond the skills of a developer is
> it?
> >
> > Regards,
> > Graham
> > --
> >
>



-- 
Marcelo Alcantara
Senior Developer/Architect
--------------------------------------------------------
maralc@gmail.com
+55 11 81968823

Re: Multi-Module Hierarchy : Eclipse vs Maven Plugins

Posted by Andrew Hughes <ah...@gmail.com>.
Thanks Graham!

I works this out just as I got your email :)

To explain this to others... taking a multi module maven project either out
of svn/cvs (Q: outside eclipse only?) or creating one from scratch leaves
you with a skeleton Maven project. With no eclipse
.project/.classpath/.whatever files in the project, it can then be made
"eclipse complient" with the "mvn eclipse:eclipse" command on the project
parent.  From this point onwards, the project source now contains all the
Maven Information, Eclipse Information, and possibly svn/cvs.

Now that you have content to import, you can "Import Existing Projects ->
Maven Project" into Eclipse. With it will come the Maven, Eclipse and
possibly svn/cvs information. The parent appears in the project list, as do
the modules.

I only have these closing questions/clarification...

Performing checkout's outside the IDE, then running "mvn eclipse:eclipse",
then  importing is a bit of a pain.... to "get around this" would people
(arguably no doubt) checkin the mvn eclipse:eclipse configuration into
svn/cvs once generated? Or is it possible to checkout a parent, then run
eclipse:eclipse within the IDE?


Thanks again,
Andrew


On Mon, Feb 25, 2008 at 9:52 AM, Graham Leggett <mi...@sharp.fm> wrote:

> Andrew Hughes wrote:
>
> > The bottom line is that eclipse can't cope with specifically with the
> > "parent" and "heirarchy" strucutre. You must checkout the whole parent
> with
> > command line (or a different IDE) and mvn install the parent to the
> local
> > repo..
>
> Yep, not too far beyond most developers at this point...
>
> > then work on each module individually checked out in isolation.
>
> Why?
>
> Just run "mvn eclipse:eclipse" in the root of your multimodule project,
> and then tell eclipse to "import existing projects" starting at the root
> of the multi module project.
>
> Eclipse will import all projects regardless of any weird directory
> structure you (or maven) might have imposed, and you can switch between
> the projects at will, and have all of them loaded at once.
>
> Maven sets up all the eclipse projects in a multimodule build so that
> each project depends directly on each other project in eclipse (as
> opposed to modules depending on the final jar of another module). This
> removes the need to run "mvn install" on one module before changes to it
> are visible to other modules in the multimodule project.
>
> Yes, the original checkout will need to be done outside of eclipse using
> a normal scm tool, but that's not beyond the skills of a developer is it?
>
> Regards,
> Graham
> --
>

Re: Multi-Module Hierarchy : Eclipse vs Maven Plugins

Posted by Graham Leggett <mi...@sharp.fm>.
Andrew Hughes wrote:

> The bottom line is that eclipse can't cope with specifically with the
> "parent" and "heirarchy" strucutre. You must checkout the whole parent with
> command line (or a different IDE) and mvn install the parent to the local
> repo..

Yep, not too far beyond most developers at this point...

> then work on each module individually checked out in isolation.

Why?

Just run "mvn eclipse:eclipse" in the root of your multimodule project, 
and then tell eclipse to "import existing projects" starting at the root 
of the multi module project.

Eclipse will import all projects regardless of any weird directory 
structure you (or maven) might have imposed, and you can switch between 
the projects at will, and have all of them loaded at once.

Maven sets up all the eclipse projects in a multimodule build so that 
each project depends directly on each other project in eclipse (as 
opposed to modules depending on the final jar of another module). This 
removes the need to run "mvn install" on one module before changes to it 
are visible to other modules in the multimodule project.

Yes, the original checkout will need to be done outside of eclipse using 
a normal scm tool, but that's not beyond the skills of a developer is it?

Regards,
Graham
--