Often the manually creation of OSGI bundles turns out to be very complex. The Maven Bundle Plugin helps you to create automatically a manifest file and it builds the bundle jar with all his dependencies. It based on the BND Tool from Peter Kriens one of the OSGI Evangelists.
An OSGI bundle imports and exports packages. Furthermore it is using and registering services from and for other services. The registration and fetching of services can be done by the implemented BundleActivator which access the BundleContext.
Example:
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Export-Package>org.developers.blog.examples.osgi.api</Export-Package>
<Private-Package>org.developers.blog.examples.osgi.core.*</Private-Package>
<Bundle-Activator>org.developers.blog.examples.osgi.impl.Activator</Bundle-Activator>
</instructions>
</configuration>
</plugin>
In this case a manifest file will be created which only exports classes from api package and uses the Activator class at the impl package to activate the bundle. If you want to define services to be registered at the OSGI container you can add the Export-Service directive.
<Export-Service>org.osgi.service.log.LogService,org.osgi.service.log.LogReaderService</Export-Service>Another interesting instruction is the Embed-Dependency directive, which embeds all POM jars to the bundle and so to the bundle classpath. That helps you to create package and bundle independent OSGI bundles. The following case includes all jar libraries with the scope compile and runtime.
<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>The Embed-Transitive parameter forces the inclusion of all transitive dependent libraries to the bundle jar.
<Embed-Transitive>true</Embed-Transitive>Regards
Rafael Sobek
Technorati Tags: BND Maven Bundle Plugin OSGI

This line of Configuration saved my evening!
<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
Thanks!!