views:

261

answers:

2

I would like to add a BuildListener to my headless build process, which is building an Eclipse product. The docs on how to do this are, shall we say, a bit scanty. I think I need to put my custom jar in a plugin and then use the org.eclipse.ant.core.extraClasspathEntries extension point to make that jar visible to Ant. But everything I have tried results in

 [myClass] which was specified to be a build listener is not an instance of org.apache.tools.ant.BuildListener.

My class implements the BuildListener interface. Various postings seem to indicate that this means my class is visible-to/loaded-by the Plugin classloader rather than the Ant classloader. But I thought the whole point of the extension point was to make jars visible to Ant...

Can anyone shed light on what I'm doing wrong? Additional info: I am trying to run this build from the Eclipse IDE at the moment using the AntRunner application.

A: 

I had this problem when I had two plugins providing an ant.jar.
Make sure you use the org.apache.ant plugin and that there is no other plugin providing another ant.jar.

Another thing I just stumbled upon: The jar containing your contribution must not be in the plugins classpath (Runtime -> Classpath).
See Eclipse Bug 34466

ILikeCoffee
Thanks. I had already solved this, but this was indeed the problem. You must be very scrupulous about the location of the contribution.
Revah
A: 

Follow the instructions as for working with contributed tasks and types found here: Developing Ant tasks and Contributed Ant tasks