How can I debug my Quarkus application that is running in dev mode?
Asked Answered
S

4

53

I have launched my application using the Quarkus dev mode (mvn quarkus:dev) and I would like to be able to debug it.

How can do that?

Stambul answered 15/3, 2019 at 20:10 Comment(0)
S
66

When launching a Quarkus app simply using mvn quarkus:dev, the running application is configured to open port 5005 for remote debugging. That means that all you have to do is point your remote debugger to that port and you will be able to debug it in your favorite IDE/lightweight editor.

If however you would like to be able to suspend the application until a debugger is connected then simply execute:

Maven:

mvn quarkus:dev -Dsuspend

Gradle:

./gradlew quarkusDev -Dsuspend=true

The same port is used (5005) but this time the application doesn't start until a remote debugger is connected. You can use -Ddebug to change the debugging port.

UPDATE

As of version 2020.3, IntelliJ Ultimate should recognize a quarkus application and automatically create a launch configuration that uses quarkus:dev under the hood.

Stambul answered 15/3, 2019 at 20:13 Comment(7)
This doesn't work for me - it just hangs at Listening for transport dt_socket at address: 5005 - attach to process works but I'm looking for a one step solution like Spring or similarIncise
The one step solution is provided by IntelliJ Ultimate as I mention above.Stambul
@Stambul This question has a lot of SEO ranking and is a FAQ. Is it still accurate?Succussion
It seems like you fixed it, thanks!Stambul
@Stambul I use gradle and gradlew quarkusDev -Dsuspend does not work for me, the application starts up and does not wait for debugger to attach. Quarkus version : 2.9.2.FinalKerosene
output when i use gradlew quarkusDev -Dsuspend -Ddebug is : Ignoring invalid value "" for "suspend" param and defaulting to "n" FAILURE: Build failed with an exception.Kerosene
Have you tried gradlew quarkusDev -Dsuspend=true?Stambul
P
33

In case you are using IntellJ IDEA run your application normally (without debugging) and then go to

RUN --> Attach to Process.

This will attach the debugger separately and has worked for me.

Postpositive answered 3/2, 2020 at 12:24 Comment(2)
How to do it in one step though?Fattal
@Jon, my answer may be helpful. Here is the link to it: https://mcmap.net/q/337908/-how-can-i-debug-my-quarkus-application-that-is-running-in-dev-modePoynter
P
9

To start a Quarkus application directly with debug configuration in IntelliJ IDEA, you have the option of using "mvn quarkus:dev" and then attaching, but it's easier to use a plugin. To debug a Quarkus app in IntelliJ IDEA, follow these steps:

  1. Install the Quarkus Run Configs plugin: https://plugins.jetbrains.com/plugin/14242-quarkus-run-configs
  2. Open the Run menu, select "Edit Configurations," and then add a new configuration for Quarkus (Maven/Gradle).
  3. Set the name, working directory, and JRE, and click "OK."

enter image description here

  1. Click the debug button or use "cmd + D".

enter image description here

Poynter answered 4/5, 2023 at 20:16 Comment(0)
M
0

The only thing that helped is to update to quarkus 3+ version

<quarkus.platform.version>3.8.2</quarkus.platform.version>

Micrometry answered 25/3 at 10:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.