Building an executable JAR using the Spring Boot Maven plugin
This recipe is intended for Spring Boot users only. If you are using a different framework that does not support building executable JARS, please refer to previous recipe.
Getting ready
The spring-boot-maven-plugin
is a Maven plugin built by the Spring Boot team to make packaging your Spring Boot applications easier. It not only allows you to package your project, but also helps with running and debugging your application. It introduces a new goal called repackage
, which pretty much repackages your original artifact (JAR or WAR) with an executable uber JAR that has all dependencies in it. If you are familiar with the maven-shade-plugin
, the repackage
goal in Spring Boot does shading.
How to do it...
In order to illustrate this recipe, we will be using the geolocation project that we built in Chapter 1 , Building Microservices with Java using Spring Boot:
- Open the
pom.xml
file of the geolocation project and look at the parent section...