I have a general question about Maven's multi module project. When and why to go for it?
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.
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.
Let's understand the structure of the multi-module application that we have created. Step 1: Create a Maven Project with the name spring-boot-multimodule. Step 2: Open the pom. xml (parent pom) file and change the packaging type jar to pom.
The answer of @Esko Luontola
Splitting the project into multiple modules is useful for example if the modules need to be deployed separately,..
could be misinterpreted. If you have modules which will be deployed separately, it's exactly the opposite. In such case, you should never create a multi-module build. This should be done via simple separate maven projects.
The idea of a multi-module build is if you have modules which belong together like an ear project which usually consists of several others like client, server, ejb, war, etc. This is usually handled via a multi-module build which means all modules have the same version number but can be accessed and used by other separately.
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