Search code examples
mavenmaven-assembly-plugin

Are maven <module> and <parent> tags mandatory?


I have a old project with a parent and many child module.

All modules are list in parent POM with < modules > tag but, in all child, there is no < parent > tags.

I can't find an explication in maven documentation. How do the < modules > and < parent > tags work? Can we use them separately?

I want to add a new module which will create a package with the maven-assembly-plugin, which will retrieve several artifacts from the different modules. It must therefore be build in last ... but the order does not seem to be respected.


Solution

  • It is usual for modules to have the main POM (the one that defines the modules) as parent. But this is not mandatory. You can build them with a different parent or not parent at all.

    The order in which modules are built is determined by Maven. It makes sure that if A depends on B, then B is built before A.