You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by Felix Meschberger <fm...@gmail.com> on 2011/01/05 22:41:30 UTC

[Bundle Plugin] Exporting Embedding Dependencies

Hi all,

I have a strange situation, which I think were not present in older
versions of the Maven Bundle Plugin.

Consider a bundle embedding a third party library and export parts of
that library:

   <project>
     ...
     <build>
       <plugins>
         <plugin>
           <groupId>org.apache.felix</groupId>
           <artifactId>maven-bundle-plugin</artifactId>
           <extensions>true</extensions>
           <configuration>
              <instructions>
                <Export-Package>
                   the/lib/package;version=1.2.3
                </Export-Package>
                <Embed-Dependency>
                   the.lib.artifact
                </Embed-Dependency>
              </instructions>
           </configuration>
         </plugin>
       </plugins>
     </build>
   </project>

Now, when this bundle is built, I end up with the bundle embedding the
library artifact plus /the/lib/package inlined into the bundle.

Is this by intent ? Can this be prevented ? Or is this a bug somewhere ?

Thanks alot for any hints.

Regards
Felix

PS: An example exhibiting the problem is the Sling Jackrabbit Server
bundle [1]: This embeds the jackrabbit-core.jar library and exports the
o.a.j.core.security.principal package. The library is embedded as a JAR
file but the exported package is inlined -- which is neither expected
nor intended.

[1]
http://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/jackrabbit-server


Re: [Bundle Plugin] Exporting Embedding Dependencies

Posted by Felix Meschberger <fm...@gmail.com>.
Hi Stuart,

Urks ... Thanks for pointing stupid me in the right direction. Should do
the RTFM stuff before wrinting.

Regards and sorry for the noise.
Felix

Am Donnerstag, den 06.01.2011, 10:06 +0000 schrieb Stuart McCulloch: 
> On Jan 5, 2011, at 21:41, Felix Meschberger <fm...@gmail.com> wrote:
> 
> > Hi all,
> > 
> > I have a strange situation, which I think were not present in older
> > versions of the Maven Bundle Plugin.
> > 
> > Consider a bundle embedding a third party library and export parts of
> > that library:
> > 
> >   <project>
> >     ...
> >     <build>
> >       <plugins>
> >         <plugin>
> >           <groupId>org.apache.felix</groupId>
> >           <artifactId>maven-bundle-plugin</artifactId>
> >           <extensions>true</extensions>
> >           <configuration>
> >              <instructions>
> >                <Export-Package>
> >                   the/lib/package;version=1.2.3
> >                </Export-Package>
> >                <Embed-Dependency>
> >                   the.lib.artifact
> >                </Embed-Dependency>
> >              </instructions>
> >           </configuration>
> >         </plugin>
> >       </plugins>
> >     </build>
> >   </project>
> > 
> > Now, when this bundle is built, I end up with the bundle embedding the
> > library artifact plus /the/lib/package inlined into the bundle.
> > 
> > Is this by intent ?
> 
> it's just doing what you told it - Export-Package both exports and inlines the package as per the bnd docs
> 
> > Can this be prevented ?
> 
> use <_exportcontents> not <Export-Package> as explained in the FAQ:
> 
> http://felix.apache.org/site/apache-felix-bundle-plugin-faq.html#ApacheFelixBundlePluginFAQ-WhenIembedadependencywhydoIseeduplicatedcontent%253F
> 
> > Or is this a bug somewhere ?
> 
> nope :)
> 
> > Thanks alot for any hints.
> > 
> > Regards
> > Felix
> > 
> > PS: An example exhibiting the problem is the Sling Jackrabbit Server
> > bundle [1]: This embeds the jackrabbit-core.jar library and exports the
> > o.a.j.core.security.principal package. The library is embedded as a JAR
> > file but the exported package is inlined -- which is neither expected
> > nor intended.
> > 
> > [1]
> > http://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/jackrabbit-server
> > 



Re: [Bundle Plugin] Exporting Embedding Dependencies

Posted by Stuart McCulloch <mc...@gmail.com>.
On Jan 5, 2011, at 21:41, Felix Meschberger <fm...@gmail.com> wrote:

> Hi all,
> 
> I have a strange situation, which I think were not present in older
> versions of the Maven Bundle Plugin.
> 
> Consider a bundle embedding a third party library and export parts of
> that library:
> 
>   <project>
>     ...
>     <build>
>       <plugins>
>         <plugin>
>           <groupId>org.apache.felix</groupId>
>           <artifactId>maven-bundle-plugin</artifactId>
>           <extensions>true</extensions>
>           <configuration>
>              <instructions>
>                <Export-Package>
>                   the/lib/package;version=1.2.3
>                </Export-Package>
>                <Embed-Dependency>
>                   the.lib.artifact
>                </Embed-Dependency>
>              </instructions>
>           </configuration>
>         </plugin>
>       </plugins>
>     </build>
>   </project>
> 
> Now, when this bundle is built, I end up with the bundle embedding the
> library artifact plus /the/lib/package inlined into the bundle.
> 
> Is this by intent ?

it's just doing what you told it - Export-Package both exports and inlines the package as per the bnd docs

> Can this be prevented ?

use <_exportcontents> not <Export-Package> as explained in the FAQ:

http://felix.apache.org/site/apache-felix-bundle-plugin-faq.html#ApacheFelixBundlePluginFAQ-WhenIembedadependencywhydoIseeduplicatedcontent%253F

> Or is this a bug somewhere ?

nope :)

> Thanks alot for any hints.
> 
> Regards
> Felix
> 
> PS: An example exhibiting the problem is the Sling Jackrabbit Server
> bundle [1]: This embeds the jackrabbit-core.jar library and exports the
> o.a.j.core.security.principal package. The library is embedded as a JAR
> file but the exported package is inlined -- which is neither expected
> nor intended.
> 
> [1]
> http://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/jackrabbit-server
>