Multiple Module Maven Project
Working with Maven single project is easy, If you are working on large project where maven been used probably you might have seen multiple modules are involved and dependent on each other. It’s good idea to separate out the project based on their behaviors/requirement in separate module so that maintenance will be easy and developer can work independently on each module. Here I will show you how to create multiple module maven project and how to handle them.
Tools needed: Eclipse
To start with this let’s create maven parent project first:
- Create maven parent project –> Open your eclipse –> File –> New –> Other –> Maven –> Maven Project –> Click Next
- Then follow below screen instruction:
- You will see parent project got created as below:
- Now we can add as many as module to this parent. For this demo I will add two child project to type jar packaging and finally will run it through console.
- Create maven module JavaHonkChild1 –> Right Click JavaHonkParent –> Maven –> Maven Module –> Click Next
- Now to create maven JavaHonkChild2 module please follow the same instruction as we did for JavaHonkChild1. You will see project structure as below:
- That’s it. Now to take build just go to parent pom.xml location and use any maven command and for demo I will use below:
- Once you run this command you will build completed successful message on the console including all child module dependency add in parent project as below:
- For more information please visit maven official documentation of multiple maven project here
Download Project: JavaHonkParent