Using a custom BuildListener with Ant and sending its output to an editor [message #276372] |
Mon, 22 November 2004 09:52  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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);
> ...
|
|
|
Powered by
FUDForum. Page generated in 0.28311 seconds