Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Packaging Jars in a plugin
Packaging Jars in a plugin [message #291746] Thu, 22 September 2005 08:55 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 #291758 is a reply to message #291756] Thu, 22 September 2005 10:52 Go to previous messageGo to next message
Eclipse UserFriend
Sébastien Alonzo wrote:
>
> 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.

http://dev.eclipse.org/newslists/news.eclipse.platform.rcp/m sg06980.html

It's better if you can do option 2 (eclipse does most of the work for
you), but option 1 should work.

Later,
PW
Re: Packaging Jars in a plugin [message #291769 is a reply to message #291758] Thu, 22 September 2005 13:00 Go to previous messageGo to next message
Eclipse UserFriend
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

It seems that the code in my.plugin.editor can compile thanks to step 7)
and can run thanks to steps 4), 5) and 8).
I would have thought step 7) to be unnecessary, since my.plugin.library
jars should be available in my.plugin.editor through the Plug-in
Dependencies library.


Another mystery for me is that it works fine when the plug-ins are
installed in Eclipse 3.1, but I got a NoClassDefFoundError when I try to
run it in Eclipse 3.0 ... beats me


If anybody could tell me what I'm doing wrong I would really appreciate.


Anyway, thanks for your help Paul.


Paul Webster wrote:
> Sébastien Alonzo wrote:
>
>>
>> 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.
>
>
> http://dev.eclipse.org/newslists/news.eclipse.platform.rcp/m sg06980.html
>
> It's better if you can do option 2 (eclipse does most of the work for
> you), but option 1 should work.
>
> Later,
> PW
Re: Packaging Jars in a plugin [message #291773 is a reply to message #291769] Thu, 22 September 2005 14:10 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Packaging Jars in a plugin [message #291857 is a reply to message #291773] Mon, 26 September 2005 03:03 Go to previous message
Eclipse UserFriend
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
Previous Topic:How to add exernal ant task within eclipse3.1.
Next Topic:Autocomplete side-effects
Goto Forum:
  


Current Time: Fri Jul 18 05:21:09 EDT 2025

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

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

Back to the top