你如何使用intellij调试java注释处理器? [英] how do you debug java annotation processors using intellij?

查看:1093
本文介绍了你如何使用intellij调试java注释处理器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最好使用IDEA IntelliJ。我尝试在处理器内设置一个断点并运行但它没有中断。

Preferably using IDEA IntelliJ. I tried setting a breakpoint inside the processor and running but it did not break.

推荐答案

如果你真的需要调试注释处理器,最好从命令行运行注释处理器,而不是在IDE中启用调试并使用IDE的调试器附加到该注释处理器。

If you really need to debug an annotation processor, it might be better to run the annotation processor from the command line rather than within your IDE with debugging enabled and attach to that using your IDE's debugger.

如果直接运行 javac ,您可以通过指定以下额外参数来调试它:

If running javac directly, you can debug this by specifying the following extra parameters:

javac -J-Xdebug -J-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 ... (usual javac parameters go here)






如果运行Maven,请使用 mvndebug 而不是标准的 mvn 命令 - Maven在进程中运行编译器。


If running Maven, use mvndebug instead of the standard mvn command - Maven runs the compiler in-process.

如果运行Ant,请在运行之前将以下内容添加到 ANT_OPTS 环境变量中:

If running Ant, add the following to the ANT_OPTS environment variable before running:

-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000






通过所有这些执行,javac,Ant或Maven进程将等待您在实际开始执行之前附加调试器。 IntelliJ的说明是此处。对于Eclipse,此处


With all these executions, the javac, Ant or Maven process will wait for you to attach your debugger before it actually starts executing. IntelliJ instructions for this are here. For Eclipse, here.

这篇关于你如何使用intellij调试java注释处理器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆