How to create a multi-module project using maven?

By | June 13, 2021

In this post, We will learn How to create a multi-module project using maven?

Let’s have a look How to create a Muti-Module project in maven using a demo project.

Please follow the below steps to Create a Multi-Module project in Eclipse:

1.Click on File ->New-> Other(First of all we are going to create a Parent Module)

2. Select Maven Project under Maven and Click on Next

3. Select Check box[Create a simple project (skip archetype selection)]

4. Provide Group Id, Artifact Id, and Version after that Click on Finish

NOTE: You should not that Packaging for Parent Module must be pom

In Step 4 we have created the Parent Module and now let’s proceed to create two Child modules(ServiceApp & Webapp) for the above parent Module

5. Click File -> New->Other

Select Maven Module and Click on Next

Mention Module Name after that Select above-Created Parent Project and Click on Next

Select Maven Archetype and click on Next

Mention Group Id , Version and Package and Click on Finish

6.Click on File ->New ->Other

Select Maven Module and Click on Next

Mention Module Name and Select Parent Project and Click on Next

Select Maven Archetype and Click on Next

Mention Group Id,Version and Package and Click on Finish

7. Now You can see and Parent Project(ParentApp) and its child projects(ServiceApp & WebApp) are created in Eclipse as follows:

8. Now We have pom.xml files of Parent Module(ParentApp) Child modules(WebApp & ServiceApp) as follows:

pom.xml file of ParentApp

pom.xml file of WebApp

pom.xml file of ServiceApp

8. Now Right-click on Parent Project(ParentApp) and go to Run As->Maven build…

 

Provide maven goals clean install as shown in below image and click on Apply then Run

You can see when we built Parent Project then its child projects(modules) also built. We can also build the child module independently.

 

That’s all about How to create a multi-module project using maven?

You May Also Like:

What is Maven?
How to install and setup Maven Environment on windows?
Create a maven project using the command line
How to import the maven project in Eclipse?
How to Create a New Maven Project in Eclipse
How to create a maven web application project in Eclipse
How to Fix missing src/main/java & src/test/java folders in the Eclipse Maven web Project?
How to create user-defined properties in Maven?
What is the maven local repository location & how to change it?
How to add or update the maven settings.xml file in eclipse?
Importing maven remote Archetype Catalogs in eclipse ?
What is POM in the maven Project?
What is Super POM in Maven Project?
Understanding the purpose of Maven Plugin
Compiling the Maven project with different JDK versions? 
Understanding of settings.xml in maven
How to enable a proxy setting in Maven?
Maven Dependency Scopes
How to generate javadoc in the maven Project
How to create a runnable JAR file with Maven?
How to add local jar files to a Maven project?
How to convert an existing Java Project to Maven in Eclipse?
How to exclude dependency in maven?
Managing External Dependencies in maven
Understanding of Maven Repositories
What is an archetype in Maven?
Snapshot Vs Version in maven
Apache Maven – Profiles

If you have any feedback or suggestion please feel free to drop in below comment box.

This for visiting this blog!!
Happy Learning!!

Leave a Reply

Your email address will not be published.