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 Developer Advocate
Daniel Oh is a Senior Principal Developer Advocate at Red Hat. He works to evangelize building cloud-native microservices and serverless functions with cloud-native runtimes to developers. He also continues to contribute to various open-source cloud projects and ecosystems as a Cloud Native Computing Foundation (CNCF) ambassador for accelerating DevOps adoption in enterprises. Daniel also speaks at technical seminars, workshops, and meetups to elaborate on new emerging technologies for enterprise developers, SREs, platform engineers, and DevOps teams.