67
votes

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?

6

6 Answers

64
votes

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.

19
votes

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.

8
votes

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.

5
votes

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.

4
votes

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

3
votes

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.