IntelliJ IDEA 2020.1 Help

Quarkus

Quarkus is a Kubernetes-native Java framework mainly aimed at building microservices. IntelliJ IDEA provides the following:

Create a new Quarkus project

  1. From the main menu, select File | New | Project.

  2. In the New Project wizard, select Quarkus and choose the Default starter service https://code.quarkus.io.

    New Quarkus project wizard

    Click Next.

  3. Configure the following Quarkus project settings:

    • Build tool: Maven

    • Group: com.example

    • Artifact: hello-quarkus

    • Version: 1.0

    Click Next.

  4. Select the necessary extensions for your application and click Next.

  5. If necessary, change the project name, location, and other settings. Click Finish.

The generated project contains a REST endpoint named ExampleResource with the following code:

package com.example; 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 open the Endpoints tool window (View | Tool Windows | Endpoints) and see this endpoint:

ExampleResource endpoint in the Endpoints tool window

Run the Quarkus application

  • Open the Maven tool window (View | Tool Windows | Maven), expand your project node, and run the quarkus:dev goal under Plugins/quarkus:

    quarkus:dev

    Alternatively, you can run this Maven goal using Run Anything: press Ctrl twice and execute mvn quarkus:dev.

By default, the application starts on http://localhost:8080. Open this address in a web browser to see the Quarkus landing page:

Quarkus application start page

If you open the http://localhost:8080/hello endpoint, you will see the string hello.

quarkus:dev runs your Quarkus application in development mode, which enables background compilation. For example, you can change the string returned by the hello() method in the ExampleResource class to Hello from a modified Quarkus endpoint and you will see this new string after you refresh http://localhost:8080/hello without restarting your application.

Last modified: 25 May 2020