You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Martin Ahrer <ma...@gmx.at> on 2008/07/17 13:46:33 UTC
[maven-bundle-plugin] duplicated content
I want to create a bundle (using the 1.4.1 plugin) that wraps 2 libraries a
and b and exposes some public API . The libraries (JAR) a and b contain the
packages
samples.deployment.a
samples.deployment.a.internal
samples.deployment.b
samples.deployment.b.internal
Both libraries should be embedded as JARS into the bundle (not inlined). But
for some strange reason the contents of packages
samples.deployment.a.internal and samples.deployment.b.internal get inlined
into the bundle (they shouldn't)
The packaging instructions looke as
<instructions>
<Embed-Dependency>
samples.deployment.b;inline=false,samples.deployment.a;inline=false,geronimo-ejb_3.0_spec,jta,jsr181-api
</Embed-Dependency>
<!-- Export-Package causes duplication of embedded contents -->
<_exportcontents>
!samples.deployment.a.internal,!samples.deployment.b.internal,samples.deployment.b,samples.deployment.a
</_exportcontents>
<Export-Package>
!samples.deployment.a.internal
</Export-Package>
<Import-Package>
org.osgi.framework
</Import-Package>
<Private-Package>
samples.deployment.ab.osgi2.internal,
samples.deployment.a.internal,
samples.deployment.b.internal
</Private-Package>
<Require-Bundle>
org.eclipse.osgi
</Require-Bundle>
<!--
add ,plugin.xml if it's present i.e.
src/main/resources,plugin.xml
-->
<Include-Resource>
src/main/resources
</Include-Resource>
</instructions>
Anybody who has an idea what's wrong? Thanks!
-----
http://www.martinahrer.at/blog http://www.martinahrer.at/blog
--
View this message in context: http://www.nabble.com/-maven-bundle-plugin--duplicated-content-tp18506669p18506669.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: [maven-bundle-plugin] duplicated content
Posted by Stuart McCulloch <st...@jayway.net>.
2008/7/17 Martin Ahrer <ma...@gmx.at>:
>
> I want to create a bundle (using the 1.4.1 plugin) that wraps 2 libraries a
> and b and exposes some public API . The libraries (JAR) a and b contain the
> packages
>
> samples.deployment.a
> samples.deployment.a.internal
>
> samples.deployment.b
> samples.deployment.b.internal
>
> Both libraries should be embedded as JARS into the bundle (not inlined).
> But
> for some strange reason the contents of packages
> samples.deployment.a.internal and samples.deployment.b.internal get inlined
> into the bundle (they shouldn't)
>
Hi Martin,
the Private-Package instruction below is telling Bnd to pull
those internal packages into the bundle (ie. inlining them)
- you don't need this instruction if you're embedding them
in summary:
Bnd uses Export-Package, Private-Package and
Include-Resource to pull content into the bundle
Embed-Dependency is translated into the correct
Include-Resource and Bundle-ClassPath clauses
for any dependencies you want to embed/inline
<_exportcontents> can alter the packages marked
as exported, without changing the bundle contents
any packages inside the bundle, but not exported
are always assumed to be private - you don't need
to explicitly mark them as such
The packaging instructions looke as
>
> <instructions>
> <Embed-Dependency>
>
>
> samples.deployment.b;inline=false,samples.deployment.a;inline=false,geronimo-ejb_3.0_spec,jta,jsr181-api
> </Embed-Dependency>
>
> <!-- Export-Package causes duplication of embedded contents -->
> <_exportcontents>
>
> !samples.deployment.a.internal,!samples.deployment.b.internal,samples.deployment.b,samples.deployment.a
> </_exportcontents>
>
because you're not using wildcards, the following should be enough:
<_exportcontents>samples.deployment.b,samples.deployment.a</_exportcontents>
negated packages only affect wildcarded packages that appear
later on in the list ( for example: !foo.bar.internal, foo.bar.* )
<Export-Package>
> !samples.deployment.a.internal
> </Export-Package>
> <Import-Package>
> org.osgi.framework
> </Import-Package>
ideally you should just leave <Import-Package> as the default
(which is *, ie. automatically calculate the necessary imports)
- otherwise you could miss some external packages that you
need to import
if you want to get a bundle installed quickly without having to
find all the other bundles that provide missing packages then
you can use this instruction:
<Import-Package>*;resolution:=optional</Import-Package>
which tells the framework to continue and resolve the bundle
even if any of the declared imports cannot be found.
<Private-Package>
> samples.deployment.ab.osgi2.internal,
> samples.deployment.a.internal,
> samples.deployment.b.internal
> </Private-Package>
this is what's causing the inlining - you don't need this
> <Require-Bundle>
> org.eclipse.osgi
> </Require-Bundle>
> <!--
> add ,plugin.xml if it's present i.e.
> src/main/resources,plugin.xml
> -->
> <Include-Resource>
> src/main/resources
> </Include-Resource>
> </instructions>
>
>
> Anybody who has an idea what's wrong? Thanks!
>
see more examples here:
http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html
HTH
-----
> http://www.martinahrer.at/blog http://www.martinahrer.at/blog
> --
> View this message in context:
> http://www.nabble.com/-maven-bundle-plugin--duplicated-content-tp18506669p18506669.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
--
Cheers, Stuart