5

What is the right way to include an additional JAR file in an Eclipse plugin? My own plugin requires apache-commons-io. I copied the JAR into my plugins directory and added it via the "Dependencies" tab of the plugin manifest. This works for me, but other users of my plugins will have to download Commons-IO manually.

What is the correct way to package Commons-IO in my plugin?

theDmi
  • 17,546
  • 6
  • 71
  • 138
  • Your method is fine, just don't forget to make this plugin available to the others through your update site. This method only works for jars which are already packaged as osgi bundles. – Peter Štibraný Jul 01 '11 at 08:18

2 Answers2

7

I usually use the following strategy:

  • If I can find the JAR in question packaged as a bundle - i.e. the MANIFEST.MF contains the correct entries - then I use this. Have a look at the Orbit project for a set of pre-packaged bundles of all sorts. org.apache.commons.io is already here...
  • If that is not possible, then I just include the JAR in my bundle, and updates MANIFEST.MF - e.g. Bundle-ClassPath: library.jar,.
Tonny Madsen
  • 12,628
  • 4
  • 31
  • 70
4

Sometimes it is cleaner to create a unique plugin for libraries. (So you can use it from several plugins, License topics, Size of your Plug-In, different version, ...)

Do so by "New ..." Category: "Plug-In Development" then "Plug-In from existing jar archieve"

Select your jars and there you go.

FlorianOver
  • 997
  • 1
  • 7
  • 11