Creating Executable Jar File With Maven Shade Plugin

Posted on October 1, 2011

In a couple of Java projects with external jar files as dependencies, you can create an executable jar file by the following ways:

1) Include the sources of external libraries in your project and build them, as part of your project build process.

2) Unpack the jar file, pack them inside your project and create a single executable jar file.

For maven users, fortunately, there is "Maven Shade Plugin", which does the work for you, probably using the second option, as described above. Even if there wasn't a plugin, I guess, it ain't that difficult to build one. To use that plugin, all you have to do is to include the following tag in your project's pom.xml:

Blog Categories
The views expressed on this blog are my personal views and do not reflect the views of my employer or campaigns I am supporting.

All sample code is provided for illustrative purposes only. These examples have not been thoroughly tested under all conditions. The writer therefore, cannot guarantee or imply reliability, serviceability, or function of these programs.

All programs contained herein are provided to you "AS IS" without any warranties of any kind. The implied warranties of non-infringement, merchantability and fitness for a particular purpose are expressly disclaimed.