Debug Ant task from eclipse

前端 未结 1 1815
-上瘾入骨i
-上瘾入骨i 2021-02-19 07:28

I am developing a custom ant task with java in the eclipse ide.

is it somehow possible to debug it? that is put a breakpoint on the java line and when ant is executed, i

1条回答
  •  醉话见心
    2021-02-19 08:04

    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
    

    This will cause the JVM running ANT to pause until you attach your debugger.

    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.

    Now when your custom task is run, it will stop at any breakpoints in your IDE.

    0 讨论(0)
提交回复
热议问题