Advantages/Disadvantages to exploded WAR files

JavaTomcatJbossWarWar Filedeployment

Java Problem Overview


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?

Java Solutions


Solution 1 - Java

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.

Solution 2 - Java

The only real benefit you receive from deploying an exploded ear/war is the ability to hot-swap files on the server, as well as the time saved on the packaging (which IMHO is negligible).

Basically - this is a useful feature for development phases. I wouldn't choose this deployment method for a production environment.

There are also some web application servers which require exploded wars for some esoteric features, but this is nothing I've encountered in regular usage.

Solution 3 - Java

At the development stage is more confortable to deploy it exploded. This way you can hot update some deployed resources (as can be the JSP pages).

For Testing and Production environments, I prefer instead the packaged deployment: ligther, and easier to handle for the deployers.

Solution 4 - Java

Con: if you are on windows, you will often find that the OS randomly locks some file in the exploded .war, and it will be hard for you to delete the entire war and redeploy.

Solution 5 - Java

Not exploding a WAR/EAR when deploying does not make any difference to the Application Server. This is because underneath, they are all exploded.

For example, if you put a WAR file under webapp of tomcat, you will see that under your work directory, your WAR file will be exploded there.

Basically, WAR/EAR are just archiving your files so that it will be easier to move around and deploy

Solution 6 - Java

AFAIK, hot deployment is possible only with exploded wars. And also during development it is easier to browse the project tree on the server. Of course there can be other advantages and disadvantages, which I will be glad to hear.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionKevin DView Question on Stackoverflow
Solution 1 - JavaMartijn VerburgView Answer on Stackoverflow
Solution 2 - JavaYuval AdamView Answer on Stackoverflow
Solution 3 - JavaTomas NarrosView Answer on Stackoverflow
Solution 4 - JavaLuca MolteniView Answer on Stackoverflow
Solution 5 - JavamezzieView Answer on Stackoverflow
Solution 6 - JavaPetar MinchevView Answer on Stackoverflow