I am working on a project that will be using OSGi. We depend on a few third party libraries that we would like to repackage as OSGi bundles. Is there a built in way in Gradle to take a non-OSGi jar, and repackage it with the OSGi headers in the manifest?
Hi,
There’s currently nothing built in specifically. It’s pretty easy to repackage a jar with a new manifest though:
apply plugin: "osgi"
task fooJar(type: Jar) {
from zipTree("path/to/some.jar")
manifest = osgiManifest {
instruction 'Bundle-Vendor', 'MyCompany'
}
}
The api for the osgiManifest method is: http://www.gradle.org/docs/current/javadoc/org/gradle/api/plugins/osgi/OsgiManifest.html
I think this should get me enough of what I need it for. Thank you.
I take that back, something is not quite right:
task createOsgiBundle(type:Jar) {
from zipTree( '/path/to/my.jar' )
manifest = osgiManifest {
instruction 'Bundle-Vendor', 'VendorName'
}
}
Running this task causes the following exception:
If you can provide a complete project that I can play with I can help further.
What’s about license problems, is it allways allowed to repackage a third party library?