Tuesday, June 17, 2008

Groovy script for building maven dependencies based on information from OSGI bundle

Sometimes when you work with OSGI container outside of Exlipse, you want to have access to dependencies for a given bundle. This information is hidden within the bundle in "META-INF/MANIFEST.MF" file. By analyzing "Bundle-Version", "Import-Package", "Export-Package" attributes we can understand which dependencies are required.

Unfortunately, this work is tedious and here we'll look for the way how to make it easier. I wrote groovy script that takes OSGI bundle and eclipse home as input parameters and produces maven dependencies (with "system" scope) section. It could be used along with "maven-ant-tasks" library for "ant" scripts or, after small modification with ant directly.