In this tutorial I will explain you how to create multi-modules maven project in Eclipse. This kind of project is a good design when you want to group similar projects and reduce the duplication in code. A multi-module project is built from a parent pom that manages a group of submodules. In most cases, the parent pom is located in the project’s root directory and must have packaging of type pom. Now, the submodules are regular Maven projects and have packaging type different than pom, and they can be built separately or through the parent pom.

Creating Multi-modules Project in Eclipse

Please follow below steps to create the multi-modules maven project.

  1. Create New maven project in Eclipse menu. Select Archetype as maven-archetype-quickstart. In next window input Group Id, Artifact Id etc. For example, Group Id – jeejava, Artifact Id – spring-microservices, Version – by default auto populated. Now open the pom.xml file and change the packaging type as pom. If you find any problem on the project then simply do Maven -> Update Project.
  1. Now do right click on the spring-microservices project and click New -> Other. In the Wizard window select Maven -> Maven Module. In the next window input Module Name as user-service. Make sure that Parent Project selected as spring-microservices. On next window select Archetype as maven-archetype-quickstart. In next window accept all defaults and click Finish. Now you will see in the parent project’s (spring-microservices) pom has been updated with <modules/> tag. Now open the user-service project’s pom.xml file and remove <groupid/> and <version/> tags. Because these two values will be inherited from parent project.
  1. Now create another module email-service in the similar way as you have created user-service. Remove the <groupid/> and <version/> tags from the pom.xml file. Now again you will see the parent’s pom file has been updated to include the email-service module under <modules/> tag.

The project structure will look like similar to the below image

multi module maven project

Now you can add dependencies, plugins etc in individual child pom file as per the project requirements.

You can also add common dependencies, plugins etc. in the parent project’s pom file and those dependencies will be automatically inherited in the child’s pom file.

If you want to override any inherited dependency in child pom then you need to declare the same dependency in child’s pom file.

Building the Project

You can build the entire project with all modules from the parent pom file or you can also build the individual module from its own pom file.

Thanks for reading.


I am a professional Web developer, Enterprise Application developer, Software Engineer and Blogger. Connect me on Roy Tutorials | TwitterFacebook Google PlusLinkedin | Reddit

5 thoughts on “Creating Multi-Modules Maven Project in Eclipse

  1. Hi!
    Soumitra Roy Sarkar hope you are doing grate. i have a question related to this multi-modules spring boot project. see below detail
    I have 3 spring boot project.
    like A,B,C, each have rest-controller like below:-

    @RequestMapping(value = “/demoa”)
    public String demoa() {
    return “demoa”;

    @RequestMapping(value = “/demob”)
    public String demob() {
    return “demob”;

    @RequestMapping(value = “/democ”)
    public String democ() {
    return “democ”;
    I add the both (B, C) project as a mavend dependency in Project(A) and compiled all



    after that i run my project like “mvn Spring-boot run” it run on 8080. When i call the “Rest /demoa” it give me the response while when i try to call other rest it show these error below:

    “timestamp”: “2018-04-25T14:47:56.816+0000”,
    “status”: 404,
    “error”: “Not Found”,
    “message”: “No message available”,
    “path”: “/demob”
    My Question is how i get the response of both 2 api while runing the proejct “A”

  2. Hi Soumitra,

    I have created modules as you have mentioned, but the hierarchy of folders as you have shown in the image is not something which eclipse shows. It shows a separate project folder for each module at the same level as the parent. Is there any setting for showing it in a hierarchy as child modules of the parent as you have shown?

Leave a Reply

Your email address will not be published. Required fields are marked *