问题描述
我开发在Eclipse IDE中的Java自定义Ant任务。
I am developing a custom ant task with java in the eclipse ide.
是它在某种程度上可以调试呢?就是把一个断点上的Java行并执行的蚂蚁时,停在那里,我可以通过code步骤?
is it somehow possible to debug it? that is put a breakpoint on the java line and when ant is executed, it stops there and i can step through the code?
编辑:既然这个问题已经被标记为重复,我想阐述为什么它是完全不同的。
edit: since this question has been closed as duplicate, i want to elaborate why it is quite different.
我期待调试Java code,构成了一个Ant任务,而不是一个Ant构建的正义的步骤。答案已经帮了我的部分,但我仍然需要弄清楚,为什么我的日食可是没有调试远程Java应用程序。
i am looking to debug the java code that makes up an ant task and not the just the steps of an ant build. the answers already helped me partially, but i still need to figure out why my eclipse doesnt have Debug Remote Java Application.
推荐答案
您需要通过输入以下运行ANT之前启用远程调试启动ANT。
You need to start ANT with the remote debug enabled by entering the following before you run ANT.
set ANT_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005
这将导致JVM运行ANT暂停,直到您附上您的调试器。
This will cause the JVM running ANT to pause until you attach your debugger.
接下来,您将需要修改ANT是使用类路径,以皮卡形成你编写自定义任务的类。我不认为有一种方式与环境瓦尔要做到这一点很容易,所以最快的就是只需编辑 ant.bat
文件。
Next you'll need to modify the classpath ANT is using in order to pickup the classes that form the custom task you're writing. I don't think there's a way to do this easily with environment vars, so the quickest thing is to just edit the ant.bat
file.
现在运行您的自定义任务时,它会停在你的IDE任何断点。
Now when your custom task is run, it will stop at any breakpoints in your IDE.
这篇关于从日食调试Ant任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!