How to debug Ant target that runs program with <java> task?

Hello,

I build an OSGi application with an Ant build script in IntelliJ IDEA 11.  It contains one target that, after compiling and packaging in a JAR my application, starts it with the Ant <java> task (using the "fork" and "spawn" options that allow the build script to end and the program to start independently).  I have no problem connecting the IntelliJ debugger in this case.  My IntelliJ "debug configuration" has the option checked to run this target before starting the debugger.

However, I also have various "test" targets that invoke JUnit via a wrapper that starts the OSGi framework (Apache Felix) via the <java> task but WITHOUT fork/spawn (the tests run within the Ant script, returning control to the script at the end).  And I can't see an option or a way to tell IntelliJ to connect its debugger when the target starts the <java> task.  In other words, how can I start the debugger when junit tests are running?

Thanks,
Christopher

0

I know my answer is late but I've solved this by the java remote debugfunction. This could be solved with the following jvm parameter:

<jvmarg value="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5900"/>

You could connect via a Remote Debug configuration

0

请先登录再写评论。