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-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 ...