The Lazy Dev

Do less. Develop more.  
« Back to blog

Maven Eclipse Plugin and the POM packaging project

I simply hate that "mvn eclipse:eclipse" does not generate project files for Maven projects that have POM packaging. Yes I know that I can simply create a Default Eclipse project on the folder but why do I have to do this action many time when the target is to avoid to repeat task?
So I hacked into and "fixed" it. That was simple. What is not is to understand reason behind the choice and provide a better alternative. Let's dig into it
 
When it comes to multi-project maven configuration, there is always a little confusion. There has been a discussion about it on the jug Milano mailing list a few months ago and what put confusion in my opinion is that "pom" packaging type is misleading cause it is used for multi-modules project as well for POM inheritance.

So, "pom" is a bad keyword for a packaging type. First, is the name of the file itself, second isn't related in any way to the to the objective of the packaging type. We should have two different keyword, something like "multi-module" and "abstract", the second behing for pom inheritance while the first one is obvious.

Back to the maven-eclipse-plugin, I expect it to generate a default Eclipse project, not a Java Project, for those two kind of projects. And the multi-module of course should not include the childs project in its Eclipse project structure: a project with just the pom.xml in it should be more than enough.

What do you think about?

Comments (3)

Jun 17, 2010
HotChiliLover said...
> And the multi-module of course should not include the childs project in its
> Eclipse project structure: a project with just the pom.xml in it should be
> more than enough.
Definitively! Unfortunately, at this point there seems to be a clash between the maven and the eclipse philosophy. Maven expects a deep directory layout for multi-module projects, eclipse a flat one. You can avoid this problem for a while by investing more time in configuration (either maven poms or eclipse projects). But there are limits, where you have to decide: e.g. the maven release plugin won't work with the flat directory layout for multi module projects.

I don't understand why maven took this totally different approach. All IDEs I know have a flat directory layout as default. I hope that these two approaches will be easier to combine in the future.

Jun 17, 2010
According to http://bit.ly/bqRW14 maven support also flat structure, but the maven release plugin does not. I started a discussion on the maven mailing list but seems nobody cares :)
Jun 17, 2010
I have checked and the maven-release-plugin 2.0 as of February 2010 includes a fix for the bug. I have recently tried M2Eclipse 0.10 and it imports all the pom project correctly. So going with the flat structure actually "fix" the problem using M2Eclipse.

Leave a comment...