I apologize in advance for the quoting, I'm thinking I should have used my
normal mail account instead of gmail now.
On 6/27/07, Steven E. Harris <[EMAIL PROTECTED]> wrote:
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.
Nah, I don't think I properly expressed my degree of newbness ;-)
If you have an OSGi bundle
packaged as a JAR that you'd like to depend on
AFAICT, the OSGi bundles aren't packaged as a single jar, they appear to be
much more complex (or maybe I am lacking some understanding of how these
bundles are packaged). For instance, in WEB-INF/platform/plugins there are
a number of directories with a fairly complex structure. For example,
WEB-INF/platform/plugins/org.apache.batik/ are the following
directories/files:
about.html (file)
about_files (dir)
lib (dir)
META-INF (dir)
plugin.properties (file)
Maybe I should also note that *none* of these are build-time dependencies
for my project, maybe that makes a difference? So this is just about
packaging the BIRT viewer in my war file.
, 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.
I'll go off and digest that, thanks!
(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":
Nope, just want to use a bundle as a dependency for now, but at some point
in the future, I will be needing to create OSGi bundles as build artifacts,
so I'll need to digest this as well.
<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.
My need right now is to use OSGi bundles as dependencies, but at some point,
we're going to be turning our own build artifacts into bundles as well.
Before I get to defining specific requirements, though, I'm going to need to
get a better understanding of OSGi in general. What project am I looking
for when I'm ready for that then?
Thanks much for the help!
Cheers,
Craig
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]