Creating a Spring Boot executable JAR
The Spring Boot magic would not be complete without providing a nice way to package the entire application including all of its dependencies, resources, and so on in one composite, executable JAR file. After the JAR file is created, it can simply be launched by running a java -jar <name>.jar
command.
We will continue with the application code that we built in the previous chapters and will add the necessary functionalities to package it. Let's go ahead and take a look at how to create the Spring Boot Uber JAR.
Note
The Uber JAR is typically known as an application bundle encapsulated in a single composite JAR file that internally contains a /lib
directory with all the dependent inner jars and optionally a /bin
directory with the executables.
How to do it...
- Let's go to our code directory from Chapter 24, Application Testing, and execute
./gradlew clean build
- With the Uber JAR built, let's launch the application by executing
java -jar build/libs/ch6-0...