O'Reilly logo

Learning Spring Boot by Greg L. Turnquist

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Bundling up the application as a runnable JAR

In the previous chapter, we learned how to run Groovy scripts with Spring Boot's CLI tool. This empowered us to create runnable JAR files, which can be deployed anywhere a JVM is installed. In this chapter, let's see how a Java-based project can be bundled up as a JAR and deployed to a popular PaaS provider.

Spring Boot comes with two handy plugins: spring-boot-maven-plugin and spring-boot-gradle-plugin. As we are using Gradle in this book, the project file from start.spring.io has spring-boot-gradle-plugin installed. Earlier, we ran the app from the command line using ./gradlew bootRun. To bundle up a JAR file, we merely need to do this:

$ ./gradlew clean build
:clean
:compileJava
:processResources ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required