War vs. War Exploded: Which Deployment Mode Is Right for Your Java Web App?

This article explains the differences between the WAR and WAR exploded deployment modes in Java web projects, compares their packaging and hot‑deployment capabilities, shows experimental results on path resolution, and provides practical tips for configuring Tomcat for effective development.

Java Backend Technology
Java Backend Technology
Java Backend Technology
War vs. War Exploded: Which Deployment Mode Is Right for Your Java Web App?

Difference between war and war exploded

When deploying a Tomcat server from IntelliJ IDEA, you may encounter a choice between war and war exploded. The two modes differ as follows:

war mode: the web project is packaged as a WAR file and uploaded to the server. war exploded mode: the web project’s directory structure is uploaded directly to the server.

(1) war mode is a traditional deployment where the project is first built into a WAR archive before being deployed.

(2) war exploded mode copies the folder, JSP pages, classes, etc., directly into Tomcat’s deployment directory, enabling hot deployment, which is commonly used during development.

(3) For hot deployment, Tomcat must be configured so that changes to JSPs are reflected immediately.

Pitfalls when using war mode

1. Project structure

The project is an SSM (Spring‑MVC, Spring, MyBatis) application.

2. Tomcat location used for deployment

3. Code for obtaining the absolute path of the context

4. Experimental process and results for both modes

(1) Using war mode, the following code returns the project’s relative path:

The path obtained is:

where C:\Software\apache-tomcat-8.0.32 is the Tomcat installation directory. This shows that war mode resolves to the deployment location of the packaged WAR.

(2) Using war exploded mode with the same code yields a different result, pointing to the project’s target directory.

Thus the two deployment modes produce different paths when retrieving the project’s relative location.

5. Summary

Based on the experiments, the war and war exploded modes deploy the application differently, leading to distinct results when obtaining the project’s relative path.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

BackendjavaHot DeploymentWAR
Java Backend Technology
Written by

Java Backend Technology

Focus on Java-related technologies: SSM, Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading. Occasionally cover DevOps tools like Jenkins, Nexus, Docker, and ELK. Also share technical insights from time to time, committed to Java full-stack development!

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.