本文介绍了如何调试在开发模式下运行的 Quarkus 应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用 Quarkus 开发模式 (mvn quarkus:dev) 启动了我的应用程序,我希望能够对其进行调试.

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

怎么做?

推荐答案

当简单地使用 mvn quarkus:dev 启动 Quarkus 应用程序时,运行的应用程序被配置为打开端口 5005 用于远程调试.这意味着您所要做的就是将远程调试器指向该端口,然后您就可以在您喜欢的 IDE/轻量级编辑器中对其进行调试.

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:

mvn quarkus:dev -Ddebug

使用相同的端口 (5005) 但这次应用程序在连接远程调试器之前不会启动.

The same port is used (5005) but this time the application doesn't start until a remote debugger is connected.

更新

自从 Quarkus 0.24 导致应用程序挂起直到连接调试器的标志是 -Dsuspend 而不是 -Ddebug(它可以仍可用于更改调试端口,但在调试器连接之前不再阻止应用程序启动).

Since Quarkus 0.24 the flag that causes the application to suspend until a debugger is connected is -Dsuspend instead of -Ddebug (which can still be used to change the debug port but no longer prevents the application from starting until a debugger connects).

更新 2

从 2020.3 版本开始,IntelliJ Ultimate 应该能够识别 quarkus 应用程序并自动创建一个在底层使用 quarkus:dev 的启动配置.

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.

这篇关于如何调试在开发模式下运行的 Quarkus 应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-16 03:03