I'm pretty newbie in Maven. Maybe that's is reason of this question :)
Today I tried to download project called Sonar Runner and just see how it's working. It was pretty strange experience for me because this project has 4 submodules:
They have respectively: 17, 2, 8 and 13 java files.
It makes me wonder why it's so fine grained. I know that you don't know what was their reasons. But I'm curious what reasons can be.
Until now I thought that size of project is a reason or separate teams working on diffrent parts of project.
But when project has 40 java files I guess size is not the reason.
What I get when I use multi-module project instead of one big project?
I tried to find out the answer in Google but with no luck.
EDIT: I found this one: Is there any benefit in using Maven Multimodule when working in a small application?
But still with project having 40 java files. Splitting it into 4 submodules seems just ridiculous for me.
Are there any other benefits?
A multi-module project is built from an aggregator POM that manages a group of submodules. In most cases, the aggregator is located in the project's root directory and must have packaging of type pom. The submodules are regular Maven projects, and they can be built separately or through the aggregator POM.
Advantages of a Multi-Module ProjectIt provides a great ability to build all sub-modules only with a single command. We can run the build command from the parent module. While building the application, the build system takes care of the build order. Deployment of the applications gets very convenient and flexible.
There is very little difference between Maven Module and Maven Project. When we create a Maven module it is mandatory to specify a parent project. As soon as we specify the parent project, <modules> … </module> is added in pom.
I'm almost always do multi-module Maven projects - even if I'm hacking some open-source experiment alone.
There many reasons to do multi-module projects:
pom
and a child jar
module. And move the organisational stuff to the parent pom
.A
depends on B
and B
depends on a part of A
, you may need to split A
in A1
and A2
.And probably much more.
These reasons are so many so since years already I prefer to start with the parent/child setup from the very start. I can't recall a single project I was involved in, which would stay single-module.
Even splitting 2-file project in 2 modules does not sound ridiculos to me, if there are reasons for this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With