On 29/12/2007, Ravindar Reddy <[EMAIL PROTECTED]> wrote:
>
> Thanks for the reply. Now I am running into another problem when I use the
> _exportcontents option. Just give some context
>
> 1. I have the following common configuration across all bundles
> <configuration>
> <instructions>
> <Bundle-SymbolicName>${pom.artifactId
> }</Bundle-SymbolicName>
>
>
> <Embed-Dependency>*;scope=compile|runtime;inline=false</Embed-Dependency>
> <Embed-Transitive>true</Embed-Transitive>
> <!-- bnd instructions -->
>
> <_include>src/main/resources/META-INF/MANIFEST.MF</_include>
> <_exportcontents>*</_exportcontents>
> </instructions>
> </configuration>
> 2. I specify MANIFEST.MF for each bundle with
> - Ignore-Package section for referred but missing code. This code is
> not invoked
> - Additional instructions are manually specified in MANIFEST.MF
> - Import-Package and Export-Package is removed so that
> "_exportcontents" option can auto generate this info
> 3. With the above settings the BND tool is including the manually
> specified Ignore-Packages from MANIFEST.MF
> - This leads to imports that does not have code. This leads to runtime
> error
>
> How do I get the above to options work together (_include and
> _exportcontents) to have non-overlapping Import-Package and Ignore-Package
> data
===============================================
Hi Ravi,
Ignore-Package is not actually a BND instruction - it's actually an output
of the BND
process that tells you which Java packages were ignored when analyzing the
bundle
to ignore packages you should use the negated syntax, for example:
<Export-Package>!com.foo, com.*</Export-Package>
note that the negated package (!com.foo) must come before its wildcard
(com.*)
Import-Package, -exportcontents, Private-Package also accept negated
packages.
( there are several examples on http://aqute.biz/Code/Bnd )
===============================================
so for your particular usecase, you could either reset exportcontents in
each
of the individual manifests (for any bundles that need to ignore packages)
ie:
-exportcontents: !foo, !bar, *
which would then override your default setting when you include the manifest
===============================================
... or you could use BND's macro system, for example set this in the
top-level POM:
<_exportcontents>${ignoredPkgs},*</_exportcontents>
and then set the ignored variable in each bundle POM as necessary:
<properties>
<ignoredPkgs>!foo, !bar</ignoredPkgs>
</properties>
BND variables start with lower case letters and are not copied to the
manifest
===============================================
note that if you want to set the variable in the bundle manifest, for
example:
ignoredPkgs: !foo, !bar
then you need to use a slightly different variable syntax in the POM
instruction:
<_exportcontents>$(ignoredPkgs),*</_exportcontents>
to stop Maven from doing it's own substitution before BND has a chance
HTH
Thanks again
> -Ravi
>
>
>
> ----- Original Message ----
> From: Stuart McCulloch <[EMAIL PROTECTED]>
> To: [email protected]
> Sent: Tuesday, December 25, 2007 6:58:49 PM
> Subject: Re: Copies class files from embedded jars
>
>
> On 24/12/2007, Ravindar Reddy <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> Cheers, Stuart
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
Cheers, Stuart