Packaging Jars in a plugin [message #291746] |
Thu, 22 September 2005 08:55  |
Eclipse User |
|
|
|
Hi everybody,
I apologize if my question seems trivial, but I've not been able to find
any help on how to do this properly.
I have an Eclipse 3.x plugin that implements custom editors as well as
custom actions. I need to use some code of another application I
developped, so I created another plugin with the required jars and I
reference this second plugin in the first one.
I must have missed some steps though, because the first plugin (let's
call it my.editor.plugin) is unable to access the classes located in the
other plugin (let's call it my.library.plugin) at runtime.
At first I referenced directly the classes from my.library.plugin jars
in my.editor.plugin build path. I realized it wasn't probably the right
way to do it, but I can't have the classes from my.library.plugin jars
to appear in my.editor.plugin plugin dependencies.
Is there anybody that could help me on that ?
Detailed documentation or tutorial would be greatly apreciated.
Sebastien.
|
|
|
Re: Packaging Jars in a plugin [message #291748 is a reply to message #291746] |
Thu, 22 September 2005 09:19   |
Eclipse User |
|
|
|
Sébastien Alonzo wrote:
> Hi everybody,
>
> I apologize if my question seems trivial, but I've not been able to find
> any help on how to do this properly.
>
> I have an Eclipse 3.x plugin that implements custom editors as well as
> custom actions. I need to use some code of another application I
> developped, so I created another plugin with the required jars and I
> reference this second plugin in the first one.
>
> I must have missed some steps though, because the first plugin (let's
> call it my.editor.plugin) is unable to access the classes located in the
> other plugin (let's call it my.library.plugin) at runtime.
>
> At first I referenced directly the classes from my.library.plugin jars
> in my.editor.plugin build path. I realized it wasn't probably the right
> way to do it, but I can't have the classes from my.library.plugin jars
> to appear in my.editor.plugin plugin dependencies.
Why not? How do you expect to use my.library.plugin classes in
my.editor.plugin if my.library.plugin jars are not in it's dependancies?
Or are you just saying you want to add the plugin dependancy, not add a
whole bunch of jar dependancies?
If my.editor.plugin needs classes from my.library.plugin jars, you can
1) add jars to my.library.plugin and follow steps for 3rd party jars
(google with site:dev.eclipse.org and 3rd party jars) or 2) create
my.library.plugin as a new project from jars, which does most of the
work for you.
Option 1 or Option 2 will allow it to work at runtime (controlled by the
manifest) as well as during compiles (controlled by the build path).
Later,
PW
|
|
|
Re: Packaging Jars in a plugin [message #291756 is a reply to message #291748] |
Thu, 22 September 2005 10:00   |
Eclipse User |
|
|
|
Paul Webster wrote:
> Sébastien Alonzo wrote:
>
>> Hi everybody,
>>
>> I apologize if my question seems trivial, but I've not been able to find
>> any help on how to do this properly.
>>
>> I have an Eclipse 3.x plugin that implements custom editors as well as
>> custom actions. I need to use some code of another application I
>> developped, so I created another plugin with the required jars and I
>> reference this second plugin in the first one.
>>
>> I must have missed some steps though, because the first plugin (let's
>> call it my.editor.plugin) is unable to access the classes located in the
>> other plugin (let's call it my.library.plugin) at runtime.
>>
>> At first I referenced directly the classes from my.library.plugin jars
>> in my.editor.plugin build path. I realized it wasn't probably the right
>> way to do it, but I can't have the classes from my.library.plugin jars
>> to appear in my.editor.plugin plugin dependencies.
>
>
> Why not? How do you expect to use my.library.plugin classes in
> my.editor.plugin if my.library.plugin jars are not in it's dependancies?
>
> Or are you just saying you want to add the plugin dependancy, not add a
> whole bunch of jar dependancies?
That's my point exactly.
>
> If my.editor.plugin needs classes from my.library.plugin jars, you can
> 1) add jars to my.library.plugin and follow steps for 3rd party jars
> (google with site:dev.eclipse.org and 3rd party jars) or 2) create
> my.library.plugin as a new project from jars, which does most of the
> work for you.
I'm looking for proper steps to do Option 1), but so far I could only
find similar questions without clear answers in the newsgroups.
>
> Option 1 or Option 2 will allow it to work at runtime (controlled by the
> manifest) as well as during compiles (controlled by the build path).
>
> Later,
> PW
|
|
|
|
|
|
Re: Packaging Jars in a plugin [message #291857 is a reply to message #291773] |
Mon, 26 September 2005 03:03  |
Eclipse User |
|
|
|
Thanks Paul,
It seems you're right after all ;-)
I actually needed step #7 to make the code in my.plugin.editor compile,
but then I cleaned the project and forced a full build and it works fine.
I must confess I never really understood what it means to "export" the
jars in the "Order and Export" tab. Now, I think I'm beginning to grasp
the concept ;-)
Besides that, any idea why this works in Eclipse 3.1 and not in Eclipse
3.0 ? (I get a NoClassDefFoundError on my.plugin.library classes when I
try to run the plugin)
Paul Webster wrote:
> Sébastien Alonzo wrote:
>
>> Well, I managed to make it work somehow but I still think there's got
>> to be another way.
>>
>> Here is what I did :
>> 1) Create a java plugin project my.plugin.library
>> 2) Copy my 3rd party jars into my.plugin.library/lib
>> 3) update the project build path by adding every jars from the lib
>> directory
>> 4) update the plugin's manifest by specifying both Bundle-ClassPath
>> and Export-Package entries to reference all my jars along with all the
>> packages included in those jars
>> 5) update the plugin's build configuration to include the lib
>> directory in binary build
>>
>> 6) Create another java plugin project my.plugin.editor
>> 7) update the project build path by adding every jars from the
>> my.plugin.library/lib directory
>> 8) update the plugin's manifest by adding my.plugin.library in the
>> Required-Bundle section
>
>
> #7 is unnecessary if you (as part of #3) export all of the jars from the
> order and export tab, and #8 has my.plugin.editor adding
> my.plugin.library as a dependancy.
>
> Creating a 3rd party jar plugin for use by other plugins:
> http://dev.eclipse.org/newslists/news.eclipse.platform.rcp/m sg06980.html
>
> Later,
> PW
|
|
|
Powered by
FUDForum. Page generated in 0.31647 seconds