Creating Quarkus applications using IntelliJ IDEA

This tutorial introduces you to JetBrains IntelliJ Quarkus plugin which lets you bootstrap and develop Quarkus projects in the simplest and most productive way.

Today, there is a wealth of plugins available to develop applications with Quarkus (including Visual Studio, Eclipse, Eclipse Che and IntelliJ Idea). This article focuses on IntelliJ Plugin for Quarkus which has the richest set of options available to develop code and handle configuration.

Installing the Quarkus plugin

Quarkus plugin for IntelliJ IDEA is available both for the Community version of the IDE and the Ultimate Edition. The simplest way to install it, is through the File | Settings | Plugin option, in the top Menu. Search “quarkus” in the plugin list:

Quarkus Tools for IntelliJ

Click on “Install” and restart the IDE when done. Now choose to create a New Quarkus Project:

quarkus jet brains intellij idea

From the Wizard, you will be able to choose the list of extensions for your Project, much the same way you would do when you use the on-line Web application (https://code.quarkus.io):

quarkus idea ide

Finish by setting the project GAV (GroupId, ArtifactId, Version) and the location for your project.

Next, the project will be available in your IDE. As an example, we will find an ExampleResource in it, which is a simple REST Endpoint

package org.acme;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path("/hello")
public class ExampleResource {

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String hello() {
        return "hello";
    }
}

You can run/debug your Quarkus projects from the Terminal or directly from the Idea Tool Bar. To that, you need to add a Quarkus Configuration first. Select the Run -> Edit Configurations… menu and click the Add new... link.

Next, the Run/Debug options will be available in the Top right corner:

quarkus tools

Top features in IntelliJ idea plugin

Besides the project bootstrap, there is a wealth of options that are available to speed up your code development and test. Let’s begin from the REST server / client extensions.

REST Services

One of my favourite features is CodeLenses. That works when you are running an application in dev mode. It provides the URL for the GET endpoints.

which ide for quarkus?

Besides, when you click on the CodeLens URL will open the URL in your default browser.

Another cool feature, when developing REST Clients, your MicroProfile Rest Client references will be checked against valid injections points. The following picture shows the reference for @RestClient SimpleRESTServiceItf:

intellij idea quarkus

Configuration hacks

Firstly, you can use code auto-completion for Quarkus properties:

quarkus tutorial

In addition, if you hover over one of those properties, you will be linked to the documentation for that property.

With regards to user properties, you can simply click on an injection point, for example a ConfigProperty:

quarkus tutorial

…and that will take you to the configuration. This will let you check instantly if the property is available in the configuration:

quarkus intellij idea

Also, if you hover on your Property, it will resolve the value for that property in a toolbox:

quarkus

Maven extensions management

Besides the standard shortcuts you can use on any Maven project, you can also use auto-completion for your extensions in pom.xml. this makes really easy to handle your dependencies from the IDE:

quarkus intellij idea

Integration with Qute

If you are using Qute template framework in your project ( Qute: a Template Engine for Quarkus applications ) then, there are a ton of features that you can leverage from IntelliJ Idea.

The one I found extremely useful is that any Template attribute has the option to generate a corresponding Qute template, or navigate to the existing template file.

quarkus qute

Within your template, you can declare the Java types at the beginning of it. For instance:

{@org.acme.Foo foo}

Then, you can validate the variables in the template file and leverage code auto-completion:

qute intellij idea quarkus

Alongside support for Java completion and validation, the extension also supports type hovering for built-in and user-defined Java classes. If you want to check the full list of capabilities provided by the Qute server through IntelliJ plugin, then check this post: https://quarkus.io/blog/intellij-quarkus-tools-1.11.0/