Create multiple module project maven eclipse
This demo will show you how to create multiple module project maven eclipse and in order to create multiple module project please use eclipse with maven plug-in. We will use eclipse Kepler to create project and this comes with maven plug-in installed. Please follow below steps:
- In eclipse click File –> New –> Other –> Maven –> Maven Project then click Next:
- Next screen select as below and click Next:
- Next select as below then click Finish:
- You will see Parent module got created with name JavaHonkParentModule as below:
- Now lets add module in it. We will add two module here for demo and where our childModule1 will be dependent on ChildModule1. To create –> Right click JavaHonkParentModule –> New –> Project –> Maven –> Maven Module as below then click Next:
- Next screen enter value as below then click Next:
- Next screen enter value as below then click Finish:
- You will see ChildModule1 got create in eclipse. Please follow same process to create ChildModule2 project. Once you are done you will see both project in eclipse as below:
- To add ChildModule1 dependency to ChildModule2 please add below in pom.xml of ChildModule2
<dependencies> <dependency> <groupId>com.javahonk.ChildModule1</groupId> <artifactId>ChildModule1</artifactId> <version>0.0.1-SNAPSHOT</version> </dependency> </dependencies>
- Important: When you are adding dependency to any module its necessary to add version of parent as you could see above. You could repeat same steps if you want to add dependency to other module. For more information please visit maven site here