Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why and when to create a multi-module Maven project?

I have a general question about Maven's multi module project. When and why to go for it?

like image 805
Hussain Avatar asked Jul 30 '12 22:07

Hussain


People also ask

Why do we need multi-module projects?

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.

What is the use of multi-module project in Maven?

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.

How do you create a multi-module project?

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.


1 Answers

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.

like image 127
khmarbaise Avatar answered Sep 28 '22 06:09

khmarbaise