theDmi
theDmi

Reputation: 18034

Add 3rd party library to an eclipse plugin

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?

Upvotes: 5

Views: 4592

Answers (2)

FlorianOver
FlorianOver

Reputation: 997

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.

Upvotes: 4

Tonny Madsen
Tonny Madsen

Reputation: 12718

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,.

Upvotes: 7

Related Questions