Why Java WARs and EARs are sweet
Software
Tuesday, 04 January 2011 18:27

More and more I am loving the concept of deploying code as a package with dependencies, of which the Java WAR and EAR formats are prime examples. In working with perl, python/django and nodejs, I have often relied on globally installed libraries to satisfy dependencies. This has a few major drawbacks.

  • If you are deploying multiple applications to the same server, you might be stuck with using the same version of a library to satisfy a common dependency.
  • Versions of dependencies are not inherently tied to versions of your application.
  • Preparing a server to run your application requires installation of many libraries, and is therefore more complex and takes more time.

I have implied two requirements to solve these problems. The first is to deploy dependencies with your application. The second is that the versions of your application must be associated with the versions of its dependencies, perhaps by including the libraries in your versioned code repository, or by including a record of the versions and having a build process that resolves the dependencies and includes them in the deployable package.

I am not necessarily suggesting that Java WARs and EARs are the only formats to do this well. Rather, I am learning from their example that deploying in such a manner is desirable. It seems to me that you should be able to achieve the same results with nodejs or python or * by simply following that deployment pattern.


blog comments powered by Disqus