Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Ant/User Guide"

< Ant
(Debugging Buildfiles)
Line 8: Line 8:
  
 
== Debugging Buildfiles ==
 
== Debugging Buildfiles ==
 +
 +
Ant provides a debugger that allows you to step through you build scripts.  You can add breakpoints, then step through the script.  There is also support for mouse hovering and the variables view.
 +
 +
=== Debugging Ant Tasks with the Remote Debugger ===
 +
 +
See this [http://www.vitorrodrigues.com/blog/2009/07/10/debugging-ant-tasks-in-eclipse/ blog post].
 +
 +
=== Debugging Ant Tasks with Self Hosting ===
 +
 +
When developing an ant task to be included in an Eclipse plug-in, you can debug the task using self hosting.
 +
 +
1) Start a runtime workbench
 +
 +
Same as you would when debugging any other plug-in.
 +
 +
2) Create a new ant script
 +
 +
It doesn't matter what kind of project you put the script in.
 +
 +
Fill in the script with the proper targets and properties.  When calling your tasks, you will have to put in their full name as defined in the org.eclipse.ant.core.antTasks extension.  When running from a built jar, just the name of the class is satisfactory, but when self hosting we need the full name.
 +
 +
3) Create a new ant launch configuration
 +
 +
Right click on the script and hold down Ctrl while clicking "Debug > Ant Script".  You can also open the launch config dialog from the main menu, "Run > External Tools > External Tools Configurations".
 +
 +
4) Set up configuration options
 +
 +
Give the configuration a name.  On the JRE tab, select "Run in the same JRE as the workspace".  If you don't change this option, debugging won't work correctly.
 +
 +
5) Run the configuration
 +
 +
If there is a problem running the task, check that you have the full name of the task written in.  You can also check that Ant knows about your task by looking on the Ant > Runtime preference page (the Tasks tab will list all known tasks).
 +
 +
6) Start debugging
 +
 +
Set some breakpoints in the host workspace.  Make sure you debug your ant script (not just run it).
 +
 +
Note: Hot Code Replace does not work when debugging this way as the jar containing the tasks must be rebuilt.
  
 
== The Ant View ==
 
== The Ant View ==

Revision as of 18:17, 14 January 2011

Creating Buildfiles

Refactoring Buildfiles

Input Handling

Running Buildfiles

Debugging Buildfiles

Ant provides a debugger that allows you to step through you build scripts. You can add breakpoints, then step through the script. There is also support for mouse hovering and the variables view.

Debugging Ant Tasks with the Remote Debugger

See this blog post.

Debugging Ant Tasks with Self Hosting

When developing an ant task to be included in an Eclipse plug-in, you can debug the task using self hosting.

1) Start a runtime workbench

Same as you would when debugging any other plug-in.

2) Create a new ant script

It doesn't matter what kind of project you put the script in.

Fill in the script with the proper targets and properties. When calling your tasks, you will have to put in their full name as defined in the org.eclipse.ant.core.antTasks extension. When running from a built jar, just the name of the class is satisfactory, but when self hosting we need the full name.

3) Create a new ant launch configuration

Right click on the script and hold down Ctrl while clicking "Debug > Ant Script". You can also open the launch config dialog from the main menu, "Run > External Tools > External Tools Configurations".

4) Set up configuration options

Give the configuration a name. On the JRE tab, select "Run in the same JRE as the workspace". If you don't change this option, debugging won't work correctly.

5) Run the configuration

If there is a problem running the task, check that you have the full name of the task written in. You can also check that Ant knows about your task by looking on the Ant > Runtime preference page (the Tasks tab will list all known tasks).

6) Start debugging

Set some breakpoints in the host workspace. Make sure you debug your ant script (not just run it).

Note: Hot Code Replace does not work when debugging this way as the jar containing the tasks must be rebuilt.

The Ant View

Back to the top