Runnable jar using maven assembly plugin

I faced a nagging problem of not able to create a runnable jar using Maven assembly plugin. I had a couple of dependencies which were required at runtime. I used the jar-with-dependecies assembly to achieve this. But my Main-Class attribute from the MANIFEST.MF was lost every time.

The solution to this problem is archive configuration under assembly plugin as described here


Nirav said...

jar with dependencies is not a good idea as, it "merge" the classes in same jar
using archive is a good idea

- nirav

Kalpak said...

Yeah, not that I am great fan of the jar-with-dependencies type of assembly, but the thing that I was writing was a command line utility, so I did not want to keep writing shell / batch script for it. I just bundled a runnable jar.