PackageDrone – Light at the End of the P2 Tunnel

For a very long time, I already wanted to blog about a really nice piece of development tool that I came across when visiting the EclipseCon Europe 2015 in Ludwigsburg, Germany. I just did not have the platform for such a blog entry. Now that there is this new development blog, I’m using the chance to publish my first entry about that tool.

I assume that all Eclipse developers are familiar with the p2 repository definition used by the PDE build and Eclipse Tycho to resolve dependencies from. With Eclipse developers, I am referring to developers writing software based on the Eclipse application framework – not just developers using the Eclipse IDE for their daily development work. Those might not even have heard about p2.

So p2 is the solution for managing and providing dependencies for software based on the Eclipse application framework. It defines the way dependencies are described and stored on disk. Hosting a p2 repository is quite easy. You just have to provide a directory with the structure defined by p2 and make it accessible via HTTP, FTP, or any other Internet protocol that can be used for downloading files.

However, when it comes to maintaining such p2 repositories, i.e. adding and/or removing content to them the hassle starts. Everytime content is added or removed, the p2 metadata needs to be regenerated. Well, there’s a tool called the FeaturesAndBundlesPublisher included in the Eclipse IDE to help you with that, but still you need to execute it every time – and the command line for it is not really intuitive with all the arguments that need to be set correctly. Of course, a batch file or even an existing Tycho plugin comes to help, but from my own experience the maintenance of p2 repositories was still a big challenge. Especially when it comes to serveral ones and maybe even repositories composed of other repositories…

And here comes PackageDrone! Simply spoken, PackageDrone is a repository manager similar to Sonatype Nexus and JFrog Artifactory for p2 repositories. But apart from that, it can manage many more repository formats, such as Debian repositories, RPM repositories, and many more. The tool is itself based on OSGi and can be extended by plugins, i.e. there’s almost no limit to supporting new use cases around repository management.

I accidentially came across that tool when attending the EclipseCon Europe 2015 in Ludwigsburg, Germany and deployed that really cool tool and successfully deployed it in a small development team’s infrastructure at one of my former employer. The entire development team was soon convinced by the features of PackageDrone and enjoyed the relief from suffering with the management of p2 repositories before.

In the meantime, several versions have been released and I personally started to like the Maven importer plugin the most. It allows for importing Maven dependencies into your (p2) repositories as long as they are shipped with the typical manifest entries required within the OSGi ecosystem.

From my personal experience as an OSGi developer, I can really only suggest you to give PackageDrone a try. Since the website and the cheat sheet already covers all necessary information to get started, I’m waiving a further elaboration on how to set it up here. And there is even a short tutorial about it written by the always-present Lars Vogel :-).

So have fun and enjoy the easy management of your p2 repositories from now on…