Code360 powered by Coding Ninjas X Code360 powered by Coding Ninjas X
Table of contents
WAR Plugin Goals
Maven WAR Plugin Usage
How to Create Maven WAR Project
Frequently Asked Questions
What are the POM files?
In what locations are Maven dependencies kept?
What do Maven properties mean?
Last Updated: Mar 27, 2024

Maven WAR Plugin

Author Harsh
0 upvote
Leveraging ChatGPT - GenAI as a Microsoft Data Expert
Prerita Agarwal
Data Specialist @
23 Jul, 2024 @ 01:30 PM


WAR files are frequently used to refer to web application resources or web application archives. A Java EE web application is installed on an application server using a WAR file. All of the web components are bundled together inside of a WAR file. JAR files, JavaServer Pages, Java servlets, Java class files, XML files, HTML files, and other resource files are among them.

Maven War Plugin

This blog will discuss the WAR plugin available in Maven. We will also see some examples of WAR Plugin in this blog.

WAR Plugin Goals

The WAR Plugin is used to collect all artefact dependencies, classes, and resources and then package them all into a web application archive. War Plugin has mainly 4 Goals. They are as follows:

🔺Exploded: We can create an exploded Web application into a directory.

🔺Help: We can use the MVN command to get the details of the WAR plugin or any other information.

🔺InPlace: Using this, we can generate the web application into the source directory of the web application.

🔺War: Using this, we can create a WAR file.


NoteWe needed Jdk version 1.7 or higher and the 3.1.0 version of Maven to use the war plugin in the Java program.

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job

Maven WAR Plugin Usage

The code below must be included in the pom.xml file to define the packaging as war.

<name>codingninjas Maven Webapp</name>


The content of the POM.xml file will look something like the below image:

POM.xml file

In order to define the war plugin in the pom.xml file while using the exploded goal, we need to define the web app directory in the plugin section.

The below code shows how we can use the war:exploded goal.

        <webappDirectory> /directory </webappDirectory>


We can also use inplace goal just by running the below command

mvn compile war:inpace

How to Create Maven WAR Project

In this section of the blog, we are going to see how we can create a maven war web app project using IntelliJ IDEA IDE. Follow the steps below

1. Open UP IntelliJ IDEA and click on new project.

Open IntelliJ IDEA

2. You will see the below screen.

Project Screen

Select Archetype as maven-archetype-webapp and enter the required information after that click on the create button.

Note: Make sure to select the java JDK version 1.7 or higher

3. Check the POM.xml file it will look like the below image




Must Read Apache Server

Frequently Asked Questions

What are the POM files?

An essential component of how Maven functions are the project object model or POM. The pom file in the current directory is observed while completing a Maven objective or task.

In what locations are Maven dependencies kept?

Each JAR, dependent file, and another item that Maven downloads is stored in its local repository. The Maven local repository, which is a folder on the local machine, stores all of the artifacts locally.

What do Maven properties mean?

Maven properties are value placeholders, just like Ant properties. You may get their values anywhere in a POM by using the notation $X, where X is the property.


In this blog, we have talked about the maven WAR Plugin. We have also seen the steps to create a maven WAR web app project using IntelliJ IDEA IDE.

If you think this blog has helped you enhance your knowledge about the above question, and if you want to learn more, check out our articles. 

🔥 Maven Architecture

🔥 Maven Web Application

🔥 Integration of Maven With Eclipse

🔥 Introduction to Maven Phases

And many more on our Coding Ninjas Studio.

Visit our website to read more such blogs. Make sure that you enroll in the courses we provide, take mock tests, solve problems available, and interview puzzles. Also, you can pay attention to interview stuff- interview experiences and an interview bundle for placement preparations. 

Please upvote our blog to help other ninjas grow.

Happy Learning!

Live masterclass