Basics and Fundamentals

Creating a Quarkus Application

mvn "io.quarkus:quarkus-maven-plugin:create" \
  -DprojectGroupId="com.redhat.developers" \
  -DprojectArtifactId="tutorial-app" \
  -DprojectVersion="1.0-SNAPSHOT" \
  -DclassName="HelloResource" \
cd tutorial-app
All the remaining parts of this tutorial assume that you’ll be working inside the project folder that was just created. In this case, tutorial-app.

Build and Run the Quarkus Application

  • JVM mode

  • Native mode

  • Native container-build mode

mvn package

To run the application in jvm mode

java -jar target/quarkus-app/quarkus-run.jar
mvn -DskipTests clean package -Pnative
Native compilation will take few minutes to complete.

To run the application in native mode

mvn package -DskipTests -Pnative -Dquarkus.native.container-build=true
Native compilation will take few minutes to complete.

To run the application in native mode you need to build a Docker image using the native file generated in previous step:

docker build -f src/main/docker/Dockerfile.native -t example/tutorial-app:1.0-SNAPSHOT .
docker run -it --rm -p 8080:8080 example/tutorial-app:1.0-SNAPSHOT

You’ll see an output like this one:

__  ____  __  _____   ___  __ ____  ______
 --/ __ \/ / / / _ | / _ \/ //_/ / / / __/
 -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
2020-05-10 22:37:10,161 INFO  [io.quarkus] (main) tutorial-app 1.0-SNAPSHOT (powered by Quarkus 1.10.2.Final) started in 0.016s. Listening on:
2020-05-10 22:37:10,162 INFO  [io.quarkus] (main) Profile prod activated.
2020-05-10 22:37:10,162 INFO  [io.quarkus] (main) Installed features: [cdi, resteasy]

Notice how fast Quarkus was ready to serve your requests. In this particular example Quarkus only required 0.016s to start.

You can open your browser with the url http://localhost:8080/hello and you should see a response like hello.

Or else if you’re a CLI person, you can run a curl command like:

curl localhost:8080/hello

Dev UI

Quarkus now ships with a new experimental Dev UI, which is available in dev mode at /q/dev by default. It allows you to quickly visualize all the extensions currently loaded, see their status and go directly to their documentation.

Stopping the application

You can stop your running application by issuing a CTRL+C in your terminal.

^C2020-05-10 23:11:03,419 INFO  [io.quarkus] (main) tutorial-app stopped in 0.007s

Quarkus was able to stop in just 0.007s. Fast to start, fast to stop. Fast always!

Testing your application

The scaffolding process also creates a test case for the example endpoint.

Check the file in the folder src/test/java to see how a Quarkus integration test looks like.

When running this test, the application is started once, then all tests are executed, and finally, the application stops. Although it is not mandatory, by default RestAssured project is used to test Rest endpoints but it is up to you to change that.

You can run the test in your IDE or by running Maven:

mvn clean test

Open the Project in your IDE

Open or import the generated project into your IDE.

If you are using vscode you can open the project with:

code .
If you use tutorial-tools, your host quarkus-tutorial/work contains the application code; point your IDE to this directory.

Live Coding (Development mode)

Stop the Quarkus application that might be running in jvm or native mode.

Live Coding or Development mode enables hot deployment with background compilation, which means that when you modify your Java files and/or your resource files and refresh your browser, these changes will automatically take effect.

This is probably one of the best features of Quarkus: enabling a very fast and productive iterative feedback loop.

Let’s start the Live Coding mode by invoking mvn. You probably won’t need to stop/start Quarkus again during this tutorial:

mvn quarkus:dev

Continuous Testing (Development mode)

Quarkus supports continuous testing, meaning that your tests will run immediately after code changes were saved. Let’s start again in Live Coding mode by invoking mvn:

mvn quarkus:dev

Quarkus will start in development mode as normal, but down the bottom of the screen you should see the following:

Tests paused
Press [r] to resume testing, [o] Toggle test output, [h] for more options>

Press r and the tests will start running. You should see the status change down the bottom of the screen as they are running, and it should finish similar to this:

All 1 test is passing (0 skipped), 1 test was run in 11705ms. Tests completed at 16:02:32.
If you don’t want to have continuous testing enabled, you can change this by adding quarkus.test.continuous-testing=disabled in

You can find more details about controlling continuous testing in this guide.