The UserService and Web Client Modules of our NixMash Microservice app are Bootique modules, which we want to package as runnable jars with Maven.
Bootique makes it easy to package up our modules as runnable jars using the Maven Shade Plugin so we can run
{PROJ_ROOT}/ $ mvn clean install
and do this.
Now Bootique does a good job laying out the steps in configuring Maven for runnable jars in the Packaging Section of their Getting Started Guide. I wanted to add this post for anyone with multiple Bootique Modules in their app who might have missed the basics from the guide.
Parent POM
In our Parent POM we list Bootique as our Parent.
Module POM
We're using the UserService Module as our example of creating a runnable Jar, so in its POM.xml (as in the Web Client POM.xml) we specify our parent POM which is in the root of our application.
Main Class
We also need to specify the Main Class of our UserService Module.
The Shade Plugin
We are inheriting much of the configuration from the Bootique Parent POM so our Shade Plugin configuration is nice and tight.
Source Code Notes for this Post
Source code discussed in this post is found in NixMash Microservices on GitHub. Code for this particular post is found in branch microservices-v0.1.0 – Initial Layout and Structure.