简体   繁体   English

如何调试在开发模式下运行的 Quarkus 应用程序?

[英]How can I debug my Quarkus application that is running in dev mode?

I have launched my application using the Quarkus dev mode ( mvn quarkus:dev ) and I would like to be able to debug it.我已经使用 Quarkus 开发模式 ( mvn quarkus:dev ) 启动了我的应用程序,我希望能够调试它。

How can do that?怎么能这样?

When launching a Quarkus app simply using mvn quarkus:dev , the running application is configured to open port 5005 for remote debugging.当简单地使用mvn quarkus:dev启动 Quarkus 应用程序时,运行的应用程序被配置为打开端口5005以进行远程调试。 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.这意味着您所要做的就是将远程调试器指向该端口,您将能够在您最喜欢的 IDE/轻量级编辑器中对其进行调试。

If however you would like to be able to suspend the application until a debugger is connected then simply execute:但是,如果您希望能够在连接调试器之前暂停应用程序,则只需执行:

mvn quarkus:dev -Ddebug

The same port is used ( 5005 ) but this time the application doesn't start until a remote debugger is connected.使用相同的端口 ( 5005 ) 但这次应用程序在连接远程调试器之前不会启动。

UPDATE更新

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).从 Quarkus 0.24 ,导致应用程序在连接调试器之前挂起的标志是-Dsuspend而不是-Ddebug (它仍可用于更改调试端口,但在调试器连接之前不再阻止应用程序启动)。

UPDATE 2更新 2

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.从 2020.3 版本开始,IntelliJ Ultimate 应该能够识别 quarkus 应用程序并自动创建一个在quarkus:dev使用quarkus:dev的启动配置。

In case you are using IntellJ IDEA run your application normally (without debugging) and then go to如果您使用IntellJ IDEA正常运行您的应用程序(无需调试),然后转到

RUN --> Attach to Process .运行 --> 附加到进程

This will attach the debugger separately and has worked for me.这将单独附加调试器并且对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM