Skip to content
mpfau edited this page Sep 14, 2010 · 3 revisions

Description

osgi2maven is a simple util for importing osgi artifact into a maven repository, which includes POM generation from osgi meta data. This is particularly useful, if you need a bunch of eclipse plugins in your maven repository.

Usage

You can use any kind of Dependency-Management tool for retrieving the needed artifacts (e.g. gradle, grape, Ivy, Maven) with the following settings:

  • Maven-Repository: ‘http://github.com/mpfau/osgi2maven/raw/master/repo/’
  • Group: de.northernideas
  • Artifact: osgi2maven
  • Version: 1.0

Usage is fairly simple. You can either use osgi2maven importing an osgi artifact:

def repo = 'http://myRepositoryUrl'
def user = 'myUser'
def pw = 'myPassword'
def deployer = new MavenDeployer(repo, user, pw)
// publish any osgi-jar you want to, the pom is generated automatically
def bundle = new File('org.eclipse.jface_3.4.2.M20090107-0800.jar')
def group = 'eclipse-34'
deployer.publishOsgiArtifact(group, bundle)

Alternatively, you can use osgi2maven to deploy any artifact, like an *.dll or *.exe file to your repository:

def repo = 'http://myRepositoryUrl'
def user = 'myUser'
def pw = 'myPassword'
def deployer = new MavenDeployer(repo, user, pw)
def group = 'exampleArtifact'
def artifactName = 'eclipse'
def version = '3.4'
def packaging = 'binary'
def expectedPom = new Pom(group: group, artifact: artifactName, version: version, packaging: packaging, bundles: [])
def file = new File('irfanview32.exe')
deployer.publishArtifact group, artifactName, version, packaging, file

Above’s examples have been written in groovy

grape-Setup

You can use osgi2maven via Groovy’s Grape as follows:

  • create a ~/.groovy/grapeConfig.xml file which adds the following repository:
<ivysettings>
  <settings defaultResolver="downloadGrapes"/>
  <resolvers>
    <chain name="downloadGrapes">
      <filesystem name="cachedGrapes">
        <ivy pattern="${user.home}/.groovy/grapes/[organisation]/[module]/ivy-[revision].xml"/>
        <artifact pattern="${user.home}/.groovy/grapes/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
      </filesystem>
      <!-- todo add 'endorsed groovy extensions' resolver here -->
      <ibiblio name="codehaus" root="http://repository.codehaus.org/" m2compatible="true"/>
      <ibiblio name="ibiblio" m2compatible="true"/>
      <ibiblio name="java.net2" root="http://download.java.net/maven/2/" m2compatible="true"/>
      <ibiblio name="osgi2maven" root="http://github.com/mpfau/osgi2maven/raw/master/repo/" m2compatible="true"/>
    </chain>
  </resolvers>
</ivysettings>

gradle

Use the following snippet, if you want to use it as part of your gradle project:

repositories {
	mavenRepo urls: 'http://github.com/mpfau/osgi2maven/raw/master/repo/'
}
dependencies {
	compile 'de.northernideas:osgi2maven:1.0'
}
Clone this wiki locally