Executable JARs

Introduction

Quarkus applications can be built as executable JARs or native binary images.

Building an Executable JAR

Build the application, passing the uberJar flag to trigger the creation of the executable JAR:

mvn clean package -DuberJar=true -DskipTests
This command produces 2 jar files:

 

  • fruit-taster-1.0-SNAPSHOT.jar - containing just the classes and resources of the projects; it’s the regular artifact produced by the Maven build
  • fruit-taster-1.0-SNAPSHOT-runner.jar - since the flag -DuberJar=true was specified, this is an executable "Uber" JAR that can be run with java -jar

Running the Application Locally

From the terminal, run the executable JAR using the Java runtime:

java -jar target/*-runner.jar

You'll notice the same startup logs as you did when running in development mode through Maven.  

As a sanity check to prove the application is running, make a simple curl call to the retrieval API from a second terminal:
curl -s http://localhost:8080/fruits
Since the import.sql script is only run in development mode, you will only see an empty reply:
[]

Cleaning Up

In the terminal with the running application, press CTRL-C to stop the running application.