0

In my project, we are given a sample project structure to be followed and I am very new to multi-module projects.

We have a parent project and 4 sub-projects that have that as parent.

And in the parent project, only 3 out of those 4 are configured as modules.

What's the difference/significance in having a project as a child but not as a module to the parent project?

Other than dependency management, what do we achieve by using multi-module project hierarchy?

l a s
  • 3,836
  • 10
  • 42
  • 61

1 Answers1

2

1) The "parent-child" relationship helps to manage dependencies. Say in your company(or project), you have some common libs that nearly all projects(or sub-projects) need to depend on, or you have a standard build configuration. You'd better put these common dependencies and build config in your parent pom, so that all children can inherit from parent. This is quite like inheritance in OOP.

2)If a project can be divided into many modules, and these modules highly couple with each other. Which means in most cases they are modified and build together, and none of them can be taken apart as a library for other projects. Then you can declare them as modules of a multi-module maven project.

But personally, I don't quite recommend multi-module maven project since it not flexible and more complex to build and to work with IDE,CI or other tools.

Weibo Li
  • 3,565
  • 3
  • 24
  • 36