Difference between revisions of "Ant/User Guide"
|Line 1:||Line 1:|
== Debugging Buildfiles ==
== Debugging Buildfiles ==
Revision as of 11:41, 7 January 2013
|Mailing List • Forums • IRC • mattermost|
|Open • Help Wanted • Bug Day|
Updating Ant on Mac OSX
This section contains some simple steps to update the version of Ant being used by Mac OSX 10.8.2.
By default the version of Ant in 10.8.2 is 1.8.2, and at the time of this writing, the latest stable version of Ant is 1.8.4. Naturally, there is no simple way to just tell the Mac to update Ant so we have to hit up the command line (Terminal).
- Grab the latest version of Ant
- Open the Terminal app
- Confirm what version of Ant you currently have installed by running
- Extract the new version of Ant and rename the folder to ant-1.8.4 - or whatever the version is you are trying to update to. This name can be anything, I just kept it in the same form as what the Mac names it.
- Move this new version of Ant to the shared java folder
sudo mv ant-1.8.4 /usr/share/java/ant-1.8.4
- The last step pis to make sure that the system links for Ant get updated to the new version. To do this we have to move the symlink from the old version by running
sudo ln -s -n -f /usr/share/java/ant-1.8.4/ /usr/share/ant
- Then we can confirm the new version is in use by once again running
There was some interesting ideas and work on buildfile refactorings here.
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.