I have a java class and I need to debug it (put breakpoints and continue using F6). I am using ANT script to init, build, deploy and run the code. I am using:
<javac srcdir="${src.dir}" destdir="${classes.dir}" debug="true" debuglevel="lines,vars,source"> .......... </javac>
But when I place the breakpoint in a line in my foo.java class and I run the ant script (the run part, Right Click on run-->Debug As-->Ant Build), Eclipse does not stop at that line of code.
What am I missing out?!
Open the Ant view (Window -> Show view -> Ant). If the build file isn't in the view then you can simply add it. Once added right click on the ant target you want to run and select Debug as -> Ant build. The Debug perspective should open up and the process should stop at your breakpoint where you can step through it.
Put your ant task in the build file, run Ant in debug mode, connect your eclipse to the ant process, and it the build will stop at the break points in your Ant task, where you can actually debug your task in the "real" environment.
(Wasn't able to comment on the given answer, so have to make another answer)
I realized that when launching Ant from Eclipse, you'll have to add fork="true" to the <java>
task. Also, it was first not clear to me how to write nested jvmargs, so here goes an example:
<java classname="..." fork="true"> <jvmarg value="-Xdebug" /> <jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5432" /> ... </java>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With