Developing Ant Tasks and Types Within Eclipse
Ant tasks and types must be loaded by an Ant classloader instead of a plug-in
classloader. This can cause problems when developing and testing new tasks and types
to be run in the same VM as Eclipse. To avoid these issues, it is necessary
to store the tasks and types in a location that is not visible to any plug-in
classloader.
The following guidelines should be followed when developing and
debugging new tasks and types to be run within the same VM as Eclipse.
- Contributed Ant tasks or types should be defined in their own source folder
within a plug-in (i.e. separate from the source folders containing regular
plug-in classes)
- Each source folder containing the Ant tasks and types should have its own
output location that does not overlap with the output location of the regular
plug-in classes.
- When testing/debugging the new Ant tasks or types using PDE Launch,
additional configuration is required:
- the project contributing
the Ant tasks or types must be configured to exclude the output folders
containing the Ant tasks and types. Use the Properties dialog for the project to
correctly configure the Plug-in Development > Runtime Classpath by removing the Ant output
directories from the plug-ins classpath.
- The JAR file containing the Ant tasks and types and specified
in the org.eclipse.ant.core.extraClasspathEntries extension,
must be built manually, or using an external tool builder.
The org.eclipse.ant.core
plugin can be used as an example of how to set up a plugin that contributes tasks within Eclipse.
For development and testing of this plugin within Eclipse, an external tool builder
explictly generates the tasks JAR when triggered on specific resource changes.
Also see Contributing tasks and types.