Bundle Development Overview
The preferred way to write bundles is to use Java as the implementation language and Apache Maven as the build system. The public code-base of Nexus Repository Manager OSS can be used as a starting point to investigate existing bundles and their source code. The easiest way to create a new bundle project is to replicate a bundle with a similar functionality. Inspect the source code of bundles with similar functionality, and read the JavaDoc documentation for the involved classes.
To gain access to all the components needed for your bundle development, you have to proxy the Sonatype grid repository with the URL:
Set up your project to include inheriting from the parent of all the Nexus Repository Manager OSS bundles with the version you are targeting as follows.
Inheriting from the nexus-plugins Parent
It is best to use the identical version of the parent as the Nexus Repository Manager instance on which you want to run your bundle. When developing a bundle you are using large parts of internals, which are subject to change from one version to another. This same logic applies to any dependencies as well.
A bundle Maven project creates a custom build output file in the form of an OSGi bundle. Enable this by changing the packaging to
bundle. In addition, you need to add the
karaf-maven-plugin and any needed dependencies. Inspect the
pom.xml files for specific bundle in the
plugins directory for further details.
These dependencies pull in a large number of transitive dependencies that expose Nexus Repository Manager functionality and other libraries to your project. Depending on the type of bundle and functionality you aim to create, additional dependencies and other details can be added to this minimal project setup. A large number of further classes is available and can be used as part of your bundle development.
With the exception of interfaces and code that is required to be accessible from modules outside of the format bundle, all code should be nested within an internal directory that will be isolated by the OSGi run-time container.
Once you have created your Maven project as described above, you can build the bundle with
mvn clean install.