Java Reference
In-Depth Information
Pretty complicated, no? You may have noticed a resemblance between this syntax and
the bnd tool syntax for selecting packages. Perhaps a few examples will make things
clearer; the following listing is taken from the Apache Felix documentation for the
maven-bundle-plugin.
Listing A.2 Embed-Dependency examples
<!-- embed all compile and runtime scope dependencies -->
<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
<!-- embed any dependencies with artifactId junit and scope runtime -->
<Embed-Dependency>junit;scope=runtime</Embed-Dependency>
<!-- inline all non-pom dependencies, except those with scope runtime -->
<Embed-Dependency>*;scope=!runtime;type=!pom;inline=true</Embed-Dependency>
<!-- embed all compile and runtime scope dependencies,
except those with artifactIds in the given list -->
<Embed-Dependency>
*;scope=compile|runtime;inline=false;
artifactId=!cli|lang|runtime|tidy|jsch
</Embed-Dependency>
<!-- inline contents of selected folders from all dependencies -->
<Embed-Dependency>*;inline=images/**|icons/**</Embed-Dependency>
In addition to Embed-Dependency , the maven-bundle-plugin adds headers to do the
following:
Select where to embed dependencies in the bundle ( Embed-Directory )
Remove the groupId from the embedded name ( Embed-StripGroup )
Remove the version from the embedded name ( Embed-StripVersion )
Consider transitive dependencies as well as direct ones ( Embed-Transitive )
Now, you may be thinking that Embed-Dependency coupled with Embed-Transitive is
a quick way to create a mega bundle containing everything you need for your applica-
tion (see section 6.2.1). Often this is true, but occasionally you end up pulling in a vast
list of optional dependencies that aren't needed at execution time. Forget about
downloading the internet—you can end up embedding it!
You should also be careful when mixing the Export-Package header (which pulls in
classes and resources) with Embed-Dependency . You can easily end up with duplicated
content: one pulled in, the other embedded. Instead, try to use the -exportcontents
directive when you want to export packages contained in embedded dependencies.
A.2.4
Deploying artifacts to OBR
In addition to embedding, the maven-bundle-plugin has built-in support for the
OSG i Bundle Repository ( OBR ; see section 10.1.2). Whenever you use Maven to
build and install a project of packaging type bundle , the maven-bundle-plugin auto-
matically updates an OBR index file (called repository.xml) at the top of your local
Maven repository. You can use this file to select and deploy your project bundles
onto OSG i frameworks:
 
Search WWH ::




Custom Search