Skip to Content
Former Member
Jan 24, 2018 at 04:19 PM

debug tests started by ant in the commandline


Is there a way to attach the IDE (my is IntelliJ) to debug the tests started via ant command line? (i.e. by the following command:

ant* alltests

I tried to set the ANT_OPTS variable in the shell (I am using Ubuntu) but nothing happened. IntelliJ did attach to the agent but the breakpoint did not work. The ANT_OPTS I set were the following:

export ANT_OPTS="$ANT_OPTS -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n"

I tried also this one

export ANT_OPTS="$ANT_OPTS -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000".

The debugger attached to the started ant task (with both suspend=y and with suspend=n) but the breakpoint did not work.

I also was in internet that you can define the agent in the build.xml. But the build.xml under platform has a little bit structure as a "normal" build.xml. I do not know, if I can add there something like this one:

  <jvmarg line="-agentlib:jdwp=transport=dt_socket,address=localhost:9009,server=y,suspend=y" />

in the target part of the build.xml

F.Y.I: Debugging the tests works well in IntelliJ when the tests are started from there.

Thanks in advantage.