Building an executable JAR using Maven Shade plugin
Before we jump into this recipe, let's talk about why we are doing this. Our goal is to construct a shippable artifact that can be executed from any platform or machine. In order to do that, we have to make sure our final artifact has all dependencies packaged in it. All we are trying to do here is build a fat JAR with all dependencies, called the uber JAR, which we talked about in the previous chapter. Almost all frameworks that help build microservices, such as Spring Boot and WildFly Swarm, have their own Maven plugins that help you build an executable JAR.
But if you use frameworks such as SparkJava and RatPack that are not really microservice frameworks but help in building HTTP APIs, you will have to make sure you use the right Maven or Gradle plugin to create an executable JAR.
Note
Ratpack is a framework that lets you build high-performance HTTP services. Internally, it uses Netty as its HTTP engine. It utilizes Netty's...