Skip to end of metadata
Go to start of metadata

Introduction

Nexus Repository Manager supports the OSGi Bundle Repository format. The OSGi Bundle format is defined by the OSGi RFC 112 "Bundle Repository." It is a format for the distribution of OSGi bundles which includes any components that are described by the OSGi standards set forth in RFC 112. An OBR repository has a single XML file that completely describes the contents of the entire repository. Nexus Repository Manager can read this OBR repository XML and create proxy repositories that can download OSGi bundles from remote OBR repositories. Nexus Repository Manager can also act as a hosting platform for OSGi bundles. You can configure your builds to publish OSGi bundles to Nexus Repository Manager, and then expose these bundle repositories to internal or external developers using Nexus Repository Manager as a publishing and distribution platform.

Nexus Repository Manager can also act as a bridge between Maven repositories and OSGi bundle repositories. When you configure a virtual OBR repository that uses a Maven 2 repository as a source repository, Nexus Repository Manager will expose components with the appropriate metadata from the Maven repository as OSGi bundles. In this way, you can unify your OSGi and non-OSGi development efforts and publish components with the appropriate OSGi metadata to Nexus Repository Manager. Non-OSGi clients can retrieve software components from a Maven repository, and OSGi aware clients can retrieve OSGi bundles from a virtual OBR repository.

The following sections detail the procedures for creating and managing OBR repositories. Nexus Repository Manager Pro has OBR support installed by default. Prior to any usage in Nexus Repository Manager OSS the Nexus OBR Plugin needs to be installed. You can download the -bundle.zip file for your specific version from the Central Repository:

Extract the file into sonatype-work/nexus/plugin-repository and restart the repository manager. Ensure to repeat the step for any upgrades.

Proxy OSGi Bundle Repositories

Nexus Repository Manager can proxy an OSGi Bundle Repository using the OBR repository XML as the remote storage location. To create a new proxy OBR repository access the Repositories view from the Views/Repositories submenu and click the Add.. button above the list of repositories and choose Proxy Repository from the drop-down of repository types.

In the New Proxy Repository configuration tab, supply a Repository ID and a Repository Name and select OBR as the Provider.

Then enter the URL to the remote repository OBR XML as the Remote Storage Location then click Save. In Figure 13.1, “Creating an OSGi Bundle Proxy Repository” a sample configuration is created for a proxy Apache Felix OBR repository.

Figure 13.1. Creating an OSGi Bundle Proxy Repository

To verify that the OBR proxy repository has been properly configured, you can then load the OBR XML from Nexus Repository Manager. If Nexus Repository Manager is properly configured, you will be able load the obr.xml by navigating to the .meta directory:

$curl http://localhost:8081/nexus/content/repositories/felix-proxy/.meta/obr.xml
<?xml version='1.0' encoding='utf-8'?>
<?xml-stylesheet type='text/xsl' href='http://www2.osgi.org/www/obr2html.xsl'?>
<repository name='Felix OBR Repository' lastmodified='1247493075615'>
	<resource id='org.apache.felix.javax.servlet/1.0.0'
			  presentationname='Servlet 2.1 API'
			  symbolicname='org.apache.felix.javax.servlet'
	uri='../bundles/org.apache.felix.javax.servlet-1.0.0.jar'
			  version='1.0.0'>
		<description>
			Servlet 2.1 API
		</description>
		<documentation>
			http://www.apache.org/
		</documentation>
		<license>
			http://www.apache.org/licenses/LICENSE-2.0.txt
		</license>
		...

Hosted OSGi Bundle Repositories

Nexus Repository Manager can host an OSGi Bundle Repository, providing you with a way to publish your own OBR bundles. To create a hosted OBR repository access the Repositories view from the Views/Repositories submenu and click the Add..  button above the list of repositories and choose Hosted Repository from the drop-down of repository types.

In the New Hosted Repository configuration tab, supply a Repository ID and a Repository Name and select OBR as the Provider.

Then enter the URL to the remote repository OBR XML as the Remote Storage Location then click Save.

In Figure 13.2, “Creating a Hosted OSGi Bundle Repository” a sample configuration is used to create a hosted OBR repository.

Figure 13.2. Creating a Hosted OSGi Bundle Repository

Virtual OSGi Bundle Repositories

Nexus Repository Manager can be configured to convert a traditional Maven repository into an OSGi Bundle repository using a virtual OBR repository. To configure a virtual OBR repository, create a new Virtual Repository in the Repositories administration area providing a Repository ID and Repository Name as well as the Source Nexus Repository ID setting the repository you want to expose as OBR. Finally set the Provider to OBR and click Save.

In Figure 13.3, “Creating a Virtual OSGi Bundle Repository from a Maven Repository” a sample configuration is used to create a virtual OBR repository that transforms the proxy repository for Maven Central into an OBR repository.

Figure 13.3. Creating a Virtual OSGi Bundle Repository from a Maven Repository

Grouping OSGi Bundle Repositories

Just like the repository manager can group Maven repositories, Eclipse update sites, and P2 repositories, it can also be configured to group OSGi Bundle Repositories. To group OSGi bundle repositories, create a new Repository Group and set the Provider to OBR and select the repositories you want to group after providing a Group ID and a Group Name .

Figure 13.4, “Creating a New OSGi Bundle Repository Group” shows an example of the a new repository group that contains a hosted OSGi Bundle repository, a virtual OSGi Bundle repository, and a OSGi Bundle proxy repository.

Figure 13.4. Creating a New OSGi Bundle Repository Group

  • No labels