Executable JARs

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/quarkus-app/quarkus-run.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.

Daniel Oh
Daniel Oh
Senior Principal Technical Marketing Manager
Daniel Oh is a senior principal technical marketing manager at Red Hat to evangelize developers for building Cloud-Native Microservices and Serverless Functions with Cloud-Native Runtimes(i.e. Quarkus, Spring Boot, Node.js) and OpenShift/Kubernetes. Daniel also continues to contribute to various cloud open-source projects and ecosystems as a CNCF ambassador for accelerating DevOps adoption in enterprises. He's speaking at lots of technical seminars, workshops, and meetups to elaborate on new emerging technologies for enterprise developers & DevOps teams.