Encodera

Thanks for reading!

Donate to the site — we work hard for you.

Contents

Dev mode and Dev UI

Dev mode is a way of running the application in which Quarkus watches the project files. You change the code, save the file, refresh the page — and see the result. There is no need to restart the server by hand. This is the main working mode while you write code.

Starting

In the project folder run:

./mvnw quarkus:dev

On Windows the command is mvnw quarkus:dev. The first start downloads dependencies, so it takes a minute or two. Then the terminal shows a logo and these lines (output shortened):

INFO  [io.quarkus] blog 1.0.0-SNAPSHOT on JVM (powered by Quarkus 3.40.1) started in 3.592s. Listening on: http://localhost:8080
INFO  [io.quarkus] Profile dev activated. Live Coding activated.
INFO  [io.quarkus] Installed features: [cdi, rest, rest-jackson, smallrye-context-propagation, vertx]

The application listens on port 8080, the dev profile is active, and the Installed features line lists the running extensions.

Calling the endpoint

In a second terminal, call the endpoint:

curl -i http://localhost:8080/hello
HTTP/1.1 200 OK
content-length: 23
Content-Type: text/plain;charset=UTF-8

Hello from Quarkus REST

The -i flag shows the status and the response headers. You can open the same address in a browser.

Live reload

Change the line in GreetingResource.java:

// src/main/java/com/example/blog/GreetingResource.java
return "Hello, blog!";

Save the file and call curl http://localhost:8080/hello again — the answer is now Hello, blog!. Quarkus checks for changes on the next request, recompiles the class and restarts the application in a fraction of a second. The log shows:

INFO  [io.quarkus.deployment.dev.RuntimeUpdatesProcessor] Restarting quarkus due to changes in GreetingResource.class.
INFO  [io.quarkus.deployment.dev.RuntimeUpdatesProcessor] Live reload total time: 1.747s

Keys in the terminal

While dev mode runs, the terminal accepts single-key commands:

KeyAction
wOpen the application in a browser
dOpen the Dev UI
rRun the tests (continuous testing)
sForce a restart of the application
hShow help
qStop the application

Dev UI

The Dev UI is a web developer console that exists only in dev mode. Open http://localhost:8080/q/dev-ui. On the left is a menu: Extensions, Configuration, Endpoints, Continuous Testing, Dev Services and more. In Extensions every extension has its own card: REST lists the endpoints and exception mappers, Hibernate ORM shows the entities and a query console. In Configuration you can view and change any setting.

A normal (prod) run has no Dev UI: the /q/dev-ui address returns 404.

Common mistake

If the code has a syntax error, the application does not crash. A request shows an "Error restarting Quarkus" page, and the terminal shows the compiler message:

ERROR [io.quarkus.deployment.dev.JavaCompilationProvider] illegal start of expression, line 14 in ...GreetingResource.java
Compilation Failed:
...GreetingResource.java:14: error: illegal start of expression
        return "Hello, Quarkus blog!" + 1 +;
                                           ^

Fix the line, save the file and refresh the page — dev mode carries on by itself. There is no need to restart quarkus:dev.

Thanks for reading!

Donate to the site — we work hard for you.