Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Advantages/Disadvantages to exploded WAR files

An answer to a question I read today suggested deploying an application as an exploded (unzipped) WAR. It got me thinking.

Every deployment I've ever done to a JBoss/Tomcat has been with a a WAR/EAR file. At least as far as I can remember.

Have I been making a mistake all these years?

Are there advantages to deploying an app in its expanded form rather than packaged up?

like image 219
Kevin D Avatar asked Oct 11 '10 13:10

Kevin D


People also ask

What is an exploded WAR file?

WAR files are convenient because they are a single package that is easy to copy, and the contents of the WAR file are compressed making it quite a compact package. The second way is to deploy all the individual files that make up a web application. This is called an exploded deployment, or an exploded WAR.

Why do we need a WAR file?

In software engineering, a WAR file (Web Application Resource or Web application ARchive) is a file used to distribute a collection of JAR-files, JavaServer Pages, Java Servlets, Java classes, XML files, tag libraries, static web pages (HTML and related files) and other resources that together constitute a web ...

What does a WAR file contain?

Each WAR file contains servlets, JSPs, a deployment descriptor, and related resource files. Static HTML files and JSP are stored at the top level of the WAR directory. The top-level directory contains the WEB-INF subdirectory which contains tag library descriptor files in addition to the following: Server-side classes.

How do WAR files work?

The WAR file is simply a JAR file (which is itself a fancy ZIP file) with specified directories for the Java code and one designated configuration file: the web. xml file, which tells the application server what to run and how to run it. WAR files always have the extension .


1 Answers

I think that was my answer mentioning the exploded WAR in the other question. Exploded WARs are easier to navigate and you can deploy 'parts' of your application that much quicker (depending on how our Web/App server deals with this), e.g. Replace a single resource like a JSP page. However it can have some drawbacks:

  1. Versioning - What version are you really running? "Hmmm, I'm not really sure now"

  2. Security - Do you have the right permissioning in place for the exploded format?

  3. Messiness - Files galore spread out all over your nice app/web server (some people really hate this).

Bottom line: I tend to go exploded for prototype Dev work and then move to proper packaging the closer to PRD I get.

like image 194
Martijn Verburg Avatar answered Sep 22 '22 14:09

Martijn Verburg