Eclipse Papercut #5 – Getting external libraries as bundles
In this episode of Eclipse Papercuts I explain how you get bundles for popolar Java libraries for your Eclipse plugin development.
I believe it has advantages to work with plugin projects instead of pure Java projects even if the plan is not to create Eclipse plugins / RCP applications.
The core strength of OSGi for this scenario is in my opinion the encapsalation and protection of your inner classes. With OSGi bundles you decide which packages of your project are exported and therefore visible to other projects (via the tab Runtime in the editor for the file plugin.xml).
This leaves only one problem: If you are using externally libraries you have to convert them into bundles / plugins.
I would be nicer to consume pre-packages bundles. As I created a bug iText should be OSGi and tweeted about it Chris Aniszczyk pointed me to Eclipse Orbit.
Eclipse Orbit provides lots of standard libraries already pre-packaged as bundles / plugins.
Lets see how you could get the iText version from Orbit. Check the Orbit FAQ to find out more.
You need to connect via cvs to the Eclipse cvs repository. CVS URL is :pserver:anonymous@dev.eclipse.org/cvsroot/tools
Navigate to “org.eclipse.orbit”. Select “com.lowagie.text” and check it out.
Orbit keeps the different version of the library as cvs branches. Select your project and select Replace With -> Another Branch or Version…

After selecting the branch and pressing ok the system will download the library and you can start using the library.
In addition to Orbit you can also use the Springsource bundle repository. On this website you can search for bundles and download then directly. You can then import them as plugin projects into your workspace.
Filed under: Eclipse, Papercut


September 21st, 2009 at 2:51 pm
Lars, better than checking these out from CVS you can just go to the Orbit download page (http://download.eclipse.org/tools/orbit/downloads/) and get the “built” bundles from one of the builds. Then just add this to your target platform and off you go.
Note also that some years ago I donated a chapter from the RCP book that talks about the bundling process. It is a little out of date but the basic principles are the same. See http://eclipse.org/orbit/documents/RCP_Chapter20.pdf.
September 21st, 2009 at 4:38 pm
@Jeff: thanks for the download link and link to your RCP chapter
September 21st, 2009 at 8:42 pm
Jeff, Lars – I think neither CVS checkout nor manual zip downloads are the way to go in 2009. Just opened a bug [https://bugs.eclipse.org/bugs/show_bug.cgi?id=290053] over at Orbit to provide a p2 repository. This way we could leverage the advantages of PDE Target provisioning to get the bundles into the target.
September 21st, 2009 at 9:18 pm
@Benjamin: Excellent idea!
September 23rd, 2009 at 7:55 pm
How up to date are the bundles in Orbit, in your experience? The Springsource bundle repository is great, but it can take weeks to months for a new version of a bundle to be added — even after filing a request.
September 24th, 2009 at 7:10 am
@Eric the iText libary I downloaded was (I believe 1.5) while the latest available version of iText is 2.1.7. Therefore in this example the lib was quite old.
I believe the requirements of libaries is driven by the Eclipse projects so if a project requires a recent version then Orbit has it. I’m not sure if there is general rule for libs in Orbit.
October 5th, 2009 at 4:49 pm
You can skip a step when checking out orbit bundles. Instead of replacing with a branch or version, if you do “Check Out As…”, then the third wizard page lets you select the version.
October 5th, 2009 at 6:34 pm
@Andrew: Thanks for the tip.
October 6th, 2009 at 6:04 pm
As always, thanks for the tips.