Craig Ching <[EMAIL PROTECTED]> writes:
> I am looking for a more practical, though obviously less than ideal,
> solution to my problem, e.g. possibly a cookbook example or even
> just a nudge in the right direction
Maybe I misunderstood your question. If you have an OSGi bundle
packaged as a JAR that you'd like to depend on, you can specify its
Maven coordinates as follows. Let's take the Felix project's OBR
bundle as an example. First, we'll separate its version specification
in the dependencyManagement section of the project's root POM:
<properties>
<felix.version>0.9.0-incubator-SNAPSHOT</felix.version>
<!-- ... -->
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.bundlerepository</artifactId>
<version>${felix.version}</version>
</dependency>
<!-- ... -->
</dependencies>
</dependencyManagement>
Then, in one of our own bundles that relies upon the Felix OBR bundle,
we refer to it like this from a module-level POM:
<dependencies>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.bundlerepository</artifactId>
<scope>provided</scope>
</dependency>
<!-- ... -->
</dependencies>
That allows the code in /our/ bundle (or any other Java artifact)
under development to refer to the classes in the Felix OBR bundle at
compile-time.
> (e.g. I did see someone post a vague reference to using the
> maven-dependency-plugin and maybe some ant plugin to unzip the
> dependency, but it was a bit hard to follow how that was all put
> together or even if that was the right first-step to pursue).
Now here I wonder if you're asking about how to build a bundle
yourself, or possibly how to extract some classes from another
bundle's JAR and have them packaged into your own artifact. If so,
those operations are taken care of by declaring your artifact to be of
packaging type "bundle":
<packaging>bundle</packaging>
and configuring the maven-bundle-plugin¹:
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<!-- Export-Package, Private-Package, ... -->
</instructions>
</configuration>
</plugin>
</plugins>
</build>
> I would absolutely love to see first-class support for OSGi bundle
> dependencies, possibly even a BIRT maven plugin would help
> immensely, but I'd assumed nothing like that was available when my
> google searches didn't turn up much information ;-)
There is some ongoing work in the other direction: tying the OSGi
Bundle Repository together with Maven's repository, so the one could
use OBR to install bundles that reside in a Maven repository. Perhaps
if you could clarify what you'd like to achieve, we could point you
toward existing solutions or at least some work underway.
Footnotes:
¹ http://cwiki.apache.org/FELIX/bundle-plugin-for-maven-bnd.html
which sits atop
http://www.aqute.biz/Code/Bnd
--
Steven E. Harris
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]