Wednesday, January 18, 2017

Anomaly in "Repackaging" Jar from SpringBoot Maven Plugin

Springboot Maven Plugin by default, should automatically rewrite Manifest in packaged jar as stated in

The original (i.e. non executable) artifact is renamed to .original by default but it is also possible to keep the original artifact using a custom classifier.
The plugin rewrites your manifest, and in particular it manages the Main-Class and Start-Class entries, so if the defaults don't work you have to configure those there (not in the jar plugin).

However, I found case where when I called maven "clean install", it didn't repackage the jar and did not rewrite the Manifest either. Thus, the jar being built was not executable."

The solution is by manually called "spring-boot:repackage" right after "clean install". So instead of maven "clean install", I call maven "clean install spring-boot:repackage".

You can read more about spring-boot:repackage in

I haven't found the exact reason why a simple maven "clean install" didn't work but at least now I got the work around.