2008/7/12 Sahoo <[EMAIL PROTECTED]>:

> Let's say I want to wrap a few library jars as a single bundle and I want
> to export all packages in all those libraries. I want to inline the
> contents. Can I configure maven-bundle-plugin like this:
> <instructions>
>   <Embed-Dependency>*;scope=compile|runtime;inline=true</Embed-Dependency>
>
>   <_exportcontents>*</_exportcontents>
> </instructions>
>

correct, I also set Private-Package to be "!*" as a temporary workaround for
an
issue that's fixed in trunk (to do with the defaults when using
exportcontents)

  <instructions>
    <Embed-Dependency>*;scope=compile;inline=true</Embed-Dependency>
    <_exportcontents>*</_exportcontents>
    <Private-Package>!*</Private-Package>
  </instructions>

but that workaround is no longer required when using 1.4.2-SNAPSHOT

Or, do I have to specify the package patterns using Export-Package?
>

no need - setting Export-Package will basically duplicate the inlining
because
that tells Bnd to pull in all classes from the classpath (including
dependencies)
but you're already inlining these classes via the Embed-Dependency.

in summary:

  <Export-Package> will pull packages into the bundle and mark them as
exported

  <_exportcontents> marks exported packages without changing the bundle
contents

btw <_exportcontents> is very useful when wrapping because you can add the
wrapped jar using Embed-Dependency and export its contents - without pulling
in any transitive dependencies, as only the direct dependency is embedded

whereas if you used <Export-Package>*</Export-Package> then you'd also get
the transitive dependencies, because they are on the compilation
classpath...

ps, this is the approach we use in the "pax-wrap-jar" script:

   http://www.ops4j.org/projects/pax/construct/help/wrap-jar.html

HTH

Thanks,
> Sahoo
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Cheers, Stuart

Reply via email to