A good way to wrap cans for OSGi with Maven

I looked at PAX tools on OPS4J, for example: this one , and I thought I found a good way:

  • Specify an artifact
  • Create a assembled jar (a jar that contains all the dependencies) from this jar and its transitive dependencies
  • Wrap it with BND to create an OSGi package

Turns out I was wrong - PAX doesn't seem to do it. (RTFM, right? :))

But I was wondering: is there something there that does what I ask?

I thought maybe I could do this by creating a simple POM and using the maven-bundle-plugin, but it seems like it might be a little cumbersome for what I ask.

NOTE. . I understand that embedding and building a jar is not really an “OSGi way”, so I wouldn’t do it if I hadn’t felt it was useful. For example, Spring.

Thanks in advance.

+5
source share
4 answers

You must support local POM in order to do this. There is no utility to be used in the library / bank and spit out the corresponding OSGi MANIFEST in the bank. ServiceMix, along with Spring, has many things that are already compiled, which you can use as examples. Two such examples that I propose to see:

+4

maven, OSGI.

, 3.2.1

git clone git://github.com/HallwayTech/maven-wrap-jar-archetype.git 
cd maven-wrap-jar-archetype
maven install

, .

mvn archetype:create \
  -DarchetypeGroupId=com.hallwaytech.osgi \
  -DarchetypeArtifactId=wrap-jar \
  -DarchetypeVersion=1.0-SNAPSHOT \
  -DgroupId=commons-collections \
  -DartifactId=commons-collections \
  -Dversion=3.2.1

cd commons-collections

mvn install

Apache Sling Felix:

mvn install -Pdeploy
+8

- , . , Apache QPid. 6 (, , , backports ..), . POM BND, uber-osgi-jar.

:

  • ( , .)
  • maven-bundle-plugin (2.1.0)
  • ,
  • 'wrap' 'package'
+2

. . , , , p2-maven-plugin. . , , , , , . , maven-bundle-plugin ( ). !

I especially like that it captures transitive dependencies and takes care of them too. If you do not need a repo, but only after a wrapped package, just try to select the cherry from the folder target/repository/plugins.

+1
source

All Articles