More and more Java projects are adding OSGi metadata to their Jar files. The benefits are clear, if you add OSGi metadata your Jar can also be used in the OSGi modular environment and be an OSGi Bundle. In many cases an ordinary Java Jar file can be an OSGi Bundle at the same time, if the appropriate OSGi metadata is added to its manifest.
So what does OSGi metadata look like? OSGi metadata is simply a number of extra headers in the Jar's META-INF/MANIFEST.MF file. While quite a large number of OSGi headers exist, the following would typically be the ones that you'd find in a library Jar file that provides OSGi metadata.
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.acme.mybundle
Bundle-Version: 1.4.1
Export-Package: org.acme.mycomponent;version="1.1.6";uses:="org.acme.tools"
Import-Package: org.acme.tools;version="[1.1, 2)"
Adding OSGi metadata to your project's Jar files can increase its user base, as OSGi-based projects can now also use it. However for some projects this might be a bit of a challenge, as not everyone is entirely familiar with the OSGi headers and especially properly versioning your bundles and packages requires some thought.
From today there is a new facility available to get help around OSGi metadata. If you are thinking of adding OSGi headers to your project but are unsure about the metadata, you can ask the OSGi community for help.
How to get help?
The OSGi bugzilla system now has a new 'product' called Metadata Advice. Anyone who is looking for help around OSGi metadata for their project can create a bug with their question at http://www.osgi.org/bugzilla/enter_bug.cgi
Metadata Advice is open to everyone who needs some help. There is no need to be an OSGi Alliance member. The nice thing about using Bugzilla for this is that each bug effectively gets its own associated mailing list.
This is a community-based system, help is provided on a voluteer basis. So if you are knowledgeable about OSGi, feel free to sign up for receiving help requests. To do this go to the Bugzilla 'Email Preferences' and watch a user called metadata.advice-inbox@www.osgi.org
When watching this user you will get notified when new requests for metadata help come in.
So - when in doubt about your OSGi metadata, create that bug and share your question with the community!
Already know all about OSGi? Then sign up to watch metadata.advice-inbox@www.osgi.org and help others with their metadata...
Happy New Year!
This is a great initiative! Most projects have workaround for having OSGi-ified versions of jars (Eclipse Orbit, SpringSource EBR...). What you propose here is a clean way to get some "official" bundles rather than re-packaged ones. Thanks for doing that, I wish a huge success!
ReplyDeleteYep, that's the idea. It's volunteer-based though so I hope that many people knowledgeable about OSGi will subscribe to watch metadata.advice-inbox@www.osgi.org in bugzilla.
ReplyDelete