Going from Plugin to OSGi Bundle
The plugin framework supports multiple types of plugins ranging from built-in plugins that are little more than an XML file to fully-fledged OSGi-based plugins.
For version 2 plugins that are deployed into the internal OSGi container, as a plugin author you can ignore all the OSGi trappings and just provide a JAR containing the
atlassian-plugin.xml descriptor file.
The Atlassian Plugin Framework 2 tries to hide the complexity of OSGi as much as possible, especially for simple plugins that do not have dependencies on other plugins. However, since version 2 plugins will be deployed on OSGi, they need to be transformed into an OSGi bundle that the OSGi container understands. The Atlassian Plugin Framework has a built-in way of transforming plugin JARs into fully-fledged OSGi bundles.
If you are familiar with OSGi and want to provide an OSGi bundle directly in order to leverage all its features, you are free to do so.
Converting a Plugin into an OSGi Bundle
The following diagram describes the process by which a plugin JAR is dynamically loaded and, at the end of the process flow, transformed into an OSGi bundle.