Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-ant-dev] Using other eclipse plugin resources from contributed ant task.

Thanks for the info.

I managed to get the task to work fairly well as a member of my plugin as you suggested. For the library, I just set the xml attribute to "" and it seems to pick up the class from the jar for the plugin.

I must be running into some problems with eclipse 3.0 M6 and its classloader. There are some classes that I can access beyond my plugin, there are others that I can access beyond my plugin if I run the ant script twice (very strange) and there are still others that I cannot execute without exceptions being generated in the OSGi plugin loading code.

Thanks for the clarifications,

Chris

Thursday, February 19, 2004 4:11 PM
To: platform-ant-dev@xxxxxxxxxxx
cc:
From: Darin Swanson <Darin_Swanson@xxxxxxxxxx>
Subject: Re: [platform-ant-dev] Using other eclipse plugin resources from contributed ant task.



I must have mislead you.
You get all the classloader "magic" for free by using the extension point and setting the correct requirements for your plugin in the plugin.xml.
You should be able to reference any class from your Ant task if that class is within the requirements chain for your plugin.
The classloader for that class will be the plugin classloader.
Using that classloader you can access the resource you need.

To get around using the bin directory as the library attribute value, we make use of the external tool builder support to automatically generate our JARs whenever we modify the source for the component classes of the JARs.

I hope I have made things clearer...
Darins



Chris McGee <cbmcgee@xxxxxxxxxx>
Sent by: platform-ant-dev-admin@xxxxxxxxxxx

02/19/04 11:50 AM
Please respond to platform-ant-dev

       
        To:        platform-ant-dev@xxxxxxxxxxx
        cc:        
        Subject:        Re: [platform-ant-dev] Using other eclipse plugin resources from contributed ant task.



Hi Darins,

Thanks for the response.

I've defined my task using the extension point. What should I specify as the library tag that would normally be pointing to a JAR with my task? Right now, I've tried just specifying the "bin" directory and it seems to work alright until we decide to package this stuff. The ClassLoaders seem to be very fragile and will load certain classes just fine but throw NPE's on others.

How does one get access to the AntClassLoader? I'm assuming that I could get the Class for the task I've defined, and ask the class for its classloader, which would be the one used in ant. After that, how can you set the classloader's parent?

Chris



Thursday, February 19, 2004 2:25 PM
To: platform-ant-dev@xxxxxxxxxxx
cc:
From: Darin Swanson <Darin_Swanson@xxxxxxxxxx>
Subject: Re: [platform-ant-dev] Using other eclipse plugin resources from contributed ant task.



If the dependancies are set up correctly for the plugin you are providing the task from.

Using the Eclipse extension point for defining tasks, the plugin classloader for the plugin contributing the task is added as a parent classloader of the AntClassLoader that is used during the build.


Then you could get a class from the other plugin, get its classloader and ask that classloader to load the resource.
I have not tried it but it should work...famous last words :-)


HTH

Darins



Chris McGee <cbmcgee@xxxxxxxxxx>
Sent by: platform-ant-dev-admin@xxxxxxxxxxx

02/19/04 10:52 AM
Please respond to platform-ant-dev

       
       To:        platform-ant-dev@xxxxxxxxxxx

       cc:        

       Subject:        [platform-ant-dev] Using other eclipse plugin resources from contributed ant task.








Hi All,

Sorry if this question has an obvious answer. I'm just starting to learn
about Ant and its integration into Eclipse 3.

Is it possible to define an Ant task in one of my plugins so that it may
access the other plugins that the plugin has dependencies? I'm able to get
an Ant task to work by creating a separate Jar that is not loaded as part
of my plugin but I would like ant task to have access to all of the
resources available from the other plugins.

Thanks,

Chris McGee
IBM
Ottawa, Canada

_______________________________________________
platform-ant-dev mailing list
platform-ant-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-ant-dev





Back to the top