No EAR, no WAR but a jar for your webapp

Simplify your deployment package.

– An Ear requires a lot of configuration and nested elements (some DB config xml files, some jars and some wars)
– A War requires some xml files, jsps and some jars
– A jar needs some classes, that’s all.

It would be neat to use the third option, for ease of use and installation. After all, the jar needs no more than itself to start.
An example of a web app project using this tip : jenkins
java -jar jenkins.war (the file can be launched as a java app or as a war webapp without any difficulty)

So, how to install this idea into your webapp project ?
1) Integrate the jetty server dependency into your project :


2) Write a server start class :

3) Add a plugin to bundle your sources into a jar :


4) Type `mvn install` and wait. Your jar is now ready to be started with `java -jar yourproject.jar`