Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Using a custom BuildListener with Ant and sending its output to an editor
Using a custom BuildListener with Ant and sending its output to an editor [message #276372] Mon, 22 November 2004 09:52 Go to next message
Eclipse UserFriend
Originally posted by: choi.netlabs.org

Hi,

I'm having problems using AntRunner from my own plugin with a custom
BuildListener. When adding a org.eclipse.ant.core.extraClasspathEntries
extension point pointing to my BuildListener implementation, the
listener is found, and loaded using the Plugin's classloader. But I
get an exception saying that the BuildListener is not an instance
of BuildListener (happens when casting it to this type in AntRunner). I
guess this is because my Plugin's classloader is used to load both
my BuildListener and the interface, but trying to cast it to the
BuildListener interface loaded by the AntRunner's classloader.

When I load my BuildListener by using AntRunner.setCustomClasspath(),
I am able to load it, but I couldn't find a way to get a reference to
my plugin's instance to send the log output to the editor it contains.

Any ideas on how to solve this dilemma?

thx,
choi

public class AntBuildListener
implements org.apache.tools.ant.BuildListener {
....
}

.... runner.addBuildListener("com.epax.ant.AntBuildListener");
runner.run(monitor);
....
Re: Using a custom BuildListener with Ant and sending its output to an editor [message #276379 is a reply to message #276372] Mon, 22 November 2004 11:12 Go to previous message
Eclipse UserFriend
http://help.eclipse.org/help21/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/ant_contributing_task.htm

Please see the "Important rules..." in the above document. These will ensure
that your BuildListener is loaded by the Ant build classloader and not the
plugin classloader.

HTH
Darins

"Matthias Fritschi" <choi@netlabs.org> wrote in message
news:cnsueo$g3s$1@www.eclipse.org...
> Hi,
>
> I'm having problems using AntRunner from my own plugin with a custom
> BuildListener. When adding a org.eclipse.ant.core.extraClasspathEntries
> extension point pointing to my BuildListener implementation, the
> listener is found, and loaded using the Plugin's classloader. But I
> get an exception saying that the BuildListener is not an instance
> of BuildListener (happens when casting it to this type in AntRunner). I
> guess this is because my Plugin's classloader is used to load both
> my BuildListener and the interface, but trying to cast it to the
> BuildListener interface loaded by the AntRunner's classloader.
>
> When I load my BuildListener by using AntRunner.setCustomClasspath(),
> I am able to load it, but I couldn't find a way to get a reference to
> my plugin's instance to send the log output to the editor it contains.
>
> Any ideas on how to solve this dilemma?
>
> thx,
> choi
>
> public class AntBuildListener
> implements org.apache.tools.ant.BuildListener {
> ...
> }
>
> ...
> runner.addBuildListener("com.epax.ant.AntBuildListener");
> runner.run(monitor);
> ...
Previous Topic:Searching help system programmatically
Next Topic:Editor accessing project properties
Goto Forum:
  


Current Time: Thu Jul 17 14:16:45 EDT 2025

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

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

Back to the top