Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » howto (possibly remotely) debug into a custom Ant task's Java code?
howto (possibly remotely) debug into a custom Ant task's Java code? [message #292618] Fri, 07 October 2005 22:20 Go to next message
Eclipse UserFriend
I'm running 3.2-M2 on winXP under java 5 (but not using any 1.5- or
even 1.4-specific features) and writing a custom Ant task. It's not
working :-( when I run the Ant script that taskdefs and uses my task,
I get spew in the Console. How to debug it? Unless I'm missing
something, the Ant debugger does not support this: see

https://bugs.eclipse.org/bugs/show_bug.cgi?id=112010
> support and document debugging into custom-task Java code

I find nothing about debugging Ant or the Ant debugger in Help>Help
Contents, so I googled and found

https://bugs.eclipse.org/bugs/show_bug.cgi?id=24130
> Ability to execute ANT tasks in the Java Debugger so I can debug the
> ANT task java code itself.

> Additional Comment #4 From Darin Swanson 2003-07-29 10:09

> You can do this with a little bit of work.

> You can use the Runtime-workbench launch configuration to self-host
> an Eclipse target or you can launch an Eclipse session in debug mode
> such that another Eclipse session can remote debug any Ant task that
> you run.

> Gilles, what exactly are you attempting to do?

> Additional Comment #5 From Gilles Scokart 2003-07-29 10:24

> I have writen my own ANT task, and I want to debug his code when
> called from an ANT script.

> I'm sure to understand your suggestion. I have tried to launch a
> separate workbench from the Debug... menu, but when I specify my
> "normal" workspace data, the workbench doen't start. Do I have to
> use a separate worspace data and rewrite the content of the project
> that contains the ant script?

> I have also seen options in the Common tab of the "Ant launcher".
> But I don't know what to put in the "Type of launch configuration",
> and the "Debug Mode" drop down is disabled.

> Could you explain me or give a link to some documentation.

> Additional Comment #6 From Darin Swanson 2003-07-29 13:46

> I am the documentation currently :-)

> You cannot have two Eclipse sessions working on the same workspace
> at the same time. You can import an existing project from one
> workspace to another using File >Import> Existing Project into
> Workspace.

> I would try this:

> launch a run-time workbench launch configuration on a new workspace
> target

> point it to a new workspace.

I create a fresh dir, and create a runconfig pointing to that
Location, taking all other defaults.

> import your project(s) as outlined above.

From the runbench, File>Import...>Existing Projects, and point back to
my devbench's project. The imported project builds.

> Run your Ant builds and debug your Ant tasks using the host Eclipse
> session.

That part I don't understand. I see the Help topic

Java Development UG>Tasks>Running and Debugging>Remote debugging>
Using the remote Java application launch configuration
> The Remote Java Application launch configuration should be used when
> debugging an application that is running on a remote VM. Since the
> application is started on the remote system, the launch
> configuration does not specify the usual information about the JRE,
> program arguments, or VM arguments. Instead, information about
> connecting to the application is supplied.

> To create a Remote Java Application launch configuration, do the
> following:

> Select Run >Debug....from the workbench menu bar (or Debug... from
> the drop-down menu on the Debug tool bar button) to show the launch
> configuration dialog.

> Select the Remote Java Application in the list of configuration
> types on the left.

> Click the New button. A new remote launch configuration is created
> and three tabs are shown: Connect, Source, and Common.

> In the Project field of the Connect tab, type or browse to select
> the project to use as a reference for the launch (for source
> lookup). A project does not need to be specified.

.... but I set it to my project.

> In the Host field of the Connect tab, type the IP address or domain
> name of the host where the Java program is running.

> If the program is running on the same machine as the workbench, type
> localhost.

.... is the default.

> In the Port field of the Connect tab, type the port where the remote
> VM is accepting connections. Generally, this port is specified when
> the remote VM is launched.

Take default=8000. I.e. I only set project=my project (and the config
name) taking all other defaults.

> The Allow termination of remote VM flag is a toggle that determines
> whether the Terminate command is enabled in the debugger. Select
> this option if you want to be able to terminate the VM to which you
> are connecting.

> Click Debug. The launch attempts to connect to a VM at the specified
> address and port, and the result is displayed in the Debug view. If
> the launcher is unable to connect to a VM at the specified address,
> an error message appears.

I get "Failed to connect to remote VM."

What do I need to do to in order to remote debug? E.g. to make the
launched Eclipse accept the connection?

Or is there a better way to debug my ant task?

Feel free to forward, or to reply directly to me (as well as the
newsgroup), and TIA.
Re: howto (possibly remotely) debug into a custom Ant task's Java code? [message #292626 is a reply to message #292618] Sat, 08 October 2005 23:14 Go to previous messageGo to next message
Eclipse UserFriend
Wow...so much of my own words :-)

In 3.2:

Set to run your Ant build in a separate JRE
Set the VM args on the JRE tab of the Ant launch configuration to enable
remote debugging.
-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=
y,suspend=y,address=8000

Start your Ant build
Launch the remote debug session

HTH
Darins

"Tom Roche" <tlroche@us.ibm.com> wrote in message
news:di7ae8$d01$1@news.eclipse.org...
>
> I'm running 3.2-M2 on winXP under java 5 (but not using any 1.5- or
> even 1.4-specific features) and writing a custom Ant task. It's not
> working :-( when I run the Ant script that taskdefs and uses my task,
> I get spew in the Console. How to debug it? Unless I'm missing
> something, the Ant debugger does not support this: see
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=112010
> > support and document debugging into custom-task Java code
>
> I find nothing about debugging Ant or the Ant debugger in Help>Help
> Contents, so I googled and found
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=24130
> > Ability to execute ANT tasks in the Java Debugger so I can debug the
> > ANT task java code itself.
>
> > Additional Comment #4 From Darin Swanson 2003-07-29 10:09
>
> > You can do this with a little bit of work.
>
> > You can use the Runtime-workbench launch configuration to self-host
> > an Eclipse target or you can launch an Eclipse session in debug mode
> > such that another Eclipse session can remote debug any Ant task that
> > you run.
>
> > Gilles, what exactly are you attempting to do?
>
> > Additional Comment #5 From Gilles Scokart 2003-07-29 10:24
>
> > I have writen my own ANT task, and I want to debug his code when
> > called from an ANT script.
>
> > I'm sure to understand your suggestion. I have tried to launch a
> > separate workbench from the Debug... menu, but when I specify my
> > "normal" workspace data, the workbench doen't start. Do I have to
> > use a separate worspace data and rewrite the content of the project
> > that contains the ant script?
>
> > I have also seen options in the Common tab of the "Ant launcher".
> > But I don't know what to put in the "Type of launch configuration",
> > and the "Debug Mode" drop down is disabled.
>
> > Could you explain me or give a link to some documentation.
>
> > Additional Comment #6 From Darin Swanson 2003-07-29 13:46
>
> > I am the documentation currently :-)
>
> > You cannot have two Eclipse sessions working on the same workspace
> > at the same time. You can import an existing project from one
> > workspace to another using File >Import> Existing Project into
> > Workspace.
>
> > I would try this:
>
> > launch a run-time workbench launch configuration on a new workspace
> > target
>
> > point it to a new workspace.
>
> I create a fresh dir, and create a runconfig pointing to that
> Location, taking all other defaults.
>
> > import your project(s) as outlined above.
>
> From the runbench, File>Import...>Existing Projects, and point back to
> my devbench's project. The imported project builds.
>
> > Run your Ant builds and debug your Ant tasks using the host Eclipse
> > session.
>
> That part I don't understand. I see the Help topic
>
> Java Development UG>Tasks>Running and Debugging>Remote debugging>
> Using the remote Java application launch configuration
> > The Remote Java Application launch configuration should be used when
> > debugging an application that is running on a remote VM. Since the
> > application is started on the remote system, the launch
> > configuration does not specify the usual information about the JRE,
> > program arguments, or VM arguments. Instead, information about
> > connecting to the application is supplied.
>
> > To create a Remote Java Application launch configuration, do the
> > following:
>
> > Select Run >Debug....from the workbench menu bar (or Debug... from
> > the drop-down menu on the Debug tool bar button) to show the launch
> > configuration dialog.
>
> > Select the Remote Java Application in the list of configuration
> > types on the left.
>
> > Click the New button. A new remote launch configuration is created
> > and three tabs are shown: Connect, Source, and Common.
>
> > In the Project field of the Connect tab, type or browse to select
> > the project to use as a reference for the launch (for source
> > lookup). A project does not need to be specified.
>
> ... but I set it to my project.
>
> > In the Host field of the Connect tab, type the IP address or domain
> > name of the host where the Java program is running.
>
> > If the program is running on the same machine as the workbench, type
> > localhost.
>
> ... is the default.
>
> > In the Port field of the Connect tab, type the port where the remote
> > VM is accepting connections. Generally, this port is specified when
> > the remote VM is launched.
>
> Take default=8000. I.e. I only set project=my project (and the config
> name) taking all other defaults.
>
> > The Allow termination of remote VM flag is a toggle that determines
> > whether the Terminate command is enabled in the debugger. Select
> > this option if you want to be able to terminate the VM to which you
> > are connecting.
>
> > Click Debug. The launch attempts to connect to a VM at the specified
> > address and port, and the result is displayed in the Debug view. If
> > the launcher is unable to connect to a VM at the specified address,
> > an error message appears.
>
> I get "Failed to connect to remote VM."
>
> What do I need to do to in order to remote debug? E.g. to make the
> launched Eclipse accept the connection?
>
> Or is there a better way to debug my ant task?
>
> Feel free to forward, or to reply directly to me (as well as the
> newsgroup), and TIA.
Re: howto (possibly remotely) debug into a custom Ant task's Java code? [message #292629 is a reply to message #292626] Sun, 09 October 2005 05:50 Go to previous message
Eclipse UserFriend
Thanks! Since

https://bugs.eclipse.org/bugs/show_bug.cgi?id=24130
> this bug should be changed to "Update the doc to explain how to
> debug an ANT task"... :-)

is RESOLVED/LATER (and apparently LATER ~= "long term" in the
Keynesian sense :-) I wrote

http://eclipsewiki.editme.com/ANTFaq#debugCustomTask

to help the next clueless bastard who stumbles down this path
(like me).
Previous Topic:Problem with basic plugin creation on Mac OS X
Next Topic:Seperation of DCT Plugins
Goto Forum:
  


Current Time: Fri Oct 31 21:26:21 EDT 2025

Powered by FUDForum. Page generated in 0.05844 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top