Simo
Simo

Reputation: 2424

How to attach a debugger of a java program, which is run by using ant, to Eclipse?

So I have a java program, for which, I have an ant script to run. I know how to enable the debugging option in the ant script, by adding two parameters (-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5432) to the ant's java task.

After adding those parameters to the java task in ant, I open the ant view in eclipse, right-click on the target I want to debug, and choose "debug as" -> "ant build".

Now, I need to attach this debugger to that same eclipse (which runs on the same machine), so that it will take me to the java code, and I can debug it line by line.

The two questions are: 1) how to attach that ant debugger to eclipse? and how to run it?

I found this question (How to debug Java code when using ANT script in Eclipse), but it does not explain how to attach an ant debugger to eclipse, and how to run.

I know, you may ask, why don't I just debug the java program directly on eclipse? The thing is, the program is quite large, have a lot of junit suite tests, and we use ant to run those tests. The ant was written by some other developer.

Thanks

Upvotes: 0

Views: 1105

Answers (1)

Andreas
Andreas

Reputation: 159260

You don't debug the ant script. You just run the ant script, even from the command line.

You then create a "Debug Configuration" in Eclipse to a "Remote Java Application", specifying the port number (5432).

Upvotes: 2

Related Questions