You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Ravindar Reddy <rr...@yahoo.com> on 2007/12/24 16:48:39 UTC

Copies class files from embedded jars

I am trying to create an example wrapper bundle around and existing jar file using maven-bundle-plugin (1.1.0-SNAPSHOT). I exported some packages from this embedded jar so that they can be used in other bundles. I found out that the bundle plug-in  copies and packages these exported class files into bundle while including the jar file. Is there a way to suppress this duplication of code as this code is part of the embedded jar

Thanks,
-Ravi


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Copies class files from embedded jars

Posted by Stuart McCulloch <st...@jayway.net>.
On 24/12/2007, Ravindar Reddy <rr...@yahoo.com> wrote:
>
>
> I am trying to create an example wrapper bundle around and existing jar
> file using maven-bundle-plugin (1.1.0-SNAPSHOT). I exported some packages
> from this embedded jar so that they can be used in other bundles. I found
> out that the bundle plug-in  copies and packages these exported class files
> into bundle while including the jar file. Is there a way to suppress this
> duplication of code as this code is part of the embedded jar


yes - this is documented on the bundleplugin wiki, which gets mirrored to
the main site at:

   http://felix.apache.org/site/maven-bundle-plugin-bnd.html

just search for the section on "Embed-Dependency and Export-Package" (copied
below):

If you embed a dependency with <Embed-Dependency>, and either your
<Export-Package>
or <Private-Package> instructions match packages inside the embedded jar,
you will see some
duplication inside the bundle.

This is because the <Export-Package> and <Private-Package> instructions will
result in
classes being inlined in the bundle, even though they also exist inside the
embedded jar.

If you want to export packages from an embedded dependency without such
duplication then
you can either inline the dependency, or use a new BND instruction called
<_exportcontents>.

<_exportcontents> behaves just like Export-Package, except it doesn't change
the content
of the bundle, just what content should be exported.

so just use <_exportcontents> to set your final exported packages, or
alternatively inline the jarfile.
Also note you can use both <Export-Package> and <_exportcontents> in the
same bundle, if you
want to pull in some classes from your classpath as well embed (and export)
a dependency.

Thanks,
> -Ravi
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


-- 
Cheers, Stuart