Part 1: Creating an empty multi module maven project structure

Enterprise projects will have multi maven modules.

Step 1: Create simple-app-parent is a package of type “pom”

press “Y” for all the questions.

Step 2: cd into your newly created root dir “simple-app-parent”

Step 3: Create a child module “simple-app-service”, which is a packaging type of “jar”

Step 4: Create a child module “simple-app-endpoint”, which is a packaging type of “war”

Take note of the different archetypes and packaging types used.

Importing into Eclipse IDE

Step 1: File –> Import –> Existing Maven Project. Select the “simple-app-parent”.

Step 2: You should now have a project structure as shown below.

maven multi-module project

maven multi-module project

Inspect the pom.xml files created. The simple-app-parent/pom.xml

The simple-app-service/pom.xml

The simple-app-endpoint/pom.xml

Now you want the simple-app-endpoint.war to include simple-app-service-1.0-SNAPSHOT.jar to be included in WEB-INF/lib. So, you need to add the following dependency to your “simple-app-endpoint/pom.xml”

After adding this, if you run “mvn clean install” you will get:

mvn-multi-module-war-1

mvn-multi-module-war2


800+ Java Interview Q&As Menu

Learn by categories on the go...
Learn by categories such as FAQs – Core Java, Key Area – Low Latency, Core Java – Java 8, JEE – Microservices, Big Data – NoSQL, Architecture – Distributed, Big Data – Spark, etc. Some posts belong to multiple categories.
Top