eclipse-m2e / m2e-core

Eclipse Public License 2.0
112 stars 115 forks source link

Let m2e discover the build tree of a project from its projects #904

Open laeubi opened 2 years ago

laeubi commented 2 years ago

Currently the view of m2e to a multi module project is simply flat... each project is handled as its own. When working with a mult-module build, there is actually some kind of tree structure of related projects that are likely to work together.

Because of this, it would be useful to have a function in m2e that takes a single project as its input and then traverse to the modules declared for them and mark such projects in a special way as a multi-module aggregator.

This can then be used to:

While it sound obvious there are some challenge:

  1. A single (physical) maven module could be mentioned in several pom.xml files
  2. A pom.xml might include modules outside the workspace
  3. A pom.xml with modules might not necessarily be a parent of the module it includes

Because of this, the idea would be to have a special project type a user could import named "Multi Module Maven Project" where I must point m2e to one pom.xml file that contains <module> declarations and m2e then uses this as the root to source the list of projects to import (that of course can contain other modules as well).

The final goal would be, that the only thing required as a user is that I point m2e to my "root pom" and everything else is handled automatically, I get a tree that represents the structure of my modules and I can build/use each sub project as if called from the command line with -am and if I change something in the child each dependent project is also updated similar to -amd).

This relates to the story

mickaelistria commented 2 years ago

Does Import > Existing Maven projects already do that?

laeubi commented 2 years ago

Does Import > Existing Maven projects already do that?

What specific part of the described story? :-)

If I use the wizard it shows the module mentioned projects to import, but each one is handled as an individual project, also after the import, I need to enable "hierarchic" project layout but then I get the layout of the file-system not the layout of the modules in the pom.