You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Felix Meschberger <fm...@gmail.com> on 2007/12/21 13:05:02 UTC

Re: Classes duplicated when using Embed-dependency

Hi Anne,

You basically have two choices of adding dependencies to your bundles:
As Export/Private-Package or by embedding as a dependency. If you embed
the dependency as you did, the jar file is included in the bundle as
instructed. You also listed two packages as exported and private
packages. So these classes are put directly into the bundle.

To solve this issue, you might want to inline the dependency inside the
bundle instead of copying the jar file (and of course drop the
Private-Package declaration as it is too much:

        <Export-Package>org.apache.log4j</Export-Package>
        ...
        <Embed-Dependency>*;inline=true</Embed-Dependency>
        
(Just out of my head, I did not actually test :-) )

Or you might just list all packages you want to have included in the
bundles as exported or private packages and just drop the
Embed-Dependency element.

Regards
Felix
        
Am Freitag, den 21.12.2007, 12:53 +0100 schrieb GERODOLLE Anne
RD-MAPS-GRE:
> Hi everybody,
>  
> I have noticed that when using Embed-Dependency, if it occurs that one
> of the packages in the embedded library is either exported or declared
> as private, classes of this package are also put in the jar, so that
> they are present twice in the bundle classpath (once in the embedded
> jar, and once directly in the bundle)..
>  
> Is that possible to avoid this, if so how ?
>  
> As an illustration, I'm including a pom.xml that builds a bundle
> embedding log4j (this is derivated from the felix log4j bundle).
>  
> Thanks in advance,
>  
> Anne
>  
> 
> 
> Anne Gérodolle
> FT/RD/MAPS/AMS/SUME
> 
> architecture de systèmes répartis
> 
> distributed system architecture
> +33 4 76 76 41 78
> anne.gerodolle@orange-ftgroup.com
> 
> 
> 
> 
>  
>  
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org


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


Re: Classes duplicated when using Embed-dependency

Posted by Stuart McCulloch <st...@jayway.net>.
On 21/12/2007, Felix Meschberger <fm...@gmail.com> wrote:
>
> Hi Anne,
>
> You basically have two choices of adding dependencies to your bundles:
> As Export/Private-Package or by embedding as a dependency. If you embed
> the dependency as you did, the jar file is included in the bundle as
> instructed. You also listed two packages as exported and private
> packages. So these classes are put directly into the bundle.
>
> To solve this issue, you might want to inline the dependency inside the
> bundle instead of copying the jar file (and of course drop the
> Private-Package declaration as it is too much:
>
>         <Export-Package>org.apache.log4j</Export-Package>
>         ...
>         <Embed-Dependency>*;inline=true</Embed-Dependency>
>
> (Just out of my head, I did not actually test :-) )
>
> Or you might just list all packages you want to have included in the
> bundles as exported or private packages and just drop the
> Embed-Dependency element.


the third way is to use <_exportcontents> which lets you customize
the exported packages after the bundle content has been calculated

with this you can put embedded jars and locally compiled classes in
the same bundle and have full control over the exported packages :)

Regards
> Felix
>
> Am Freitag, den 21.12.2007, 12:53 +0100 schrieb GERODOLLE Anne
> RD-MAPS-GRE:
> > Hi everybody,
> >
> > I have noticed that when using Embed-Dependency, if it occurs that one
> > of the packages in the embedded library is either exported or declared
> > as private, classes of this package are also put in the jar, so that
> > they are present twice in the bundle classpath (once in the embedded
> > jar, and once directly in the bundle)..
> >
> > Is that possible to avoid this, if so how ?
> >
> > As an illustration, I'm including a pom.xml that builds a bundle
> > embedding log4j (this is derivated from the felix log4j bundle).
> >
> > Thanks in advance,
> >
> > Anne
> >
> >
> >
> > Anne Gérodolle
> > FT/RD/MAPS/AMS/SUME
> >
> > architecture de systèmes répartis
> >
> > distributed system architecture
> > +33 4 76 76 41 78
> > anne.gerodolle@orange-ftgroup.com
> >
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > For additional commands, e-mail: users-help@felix.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


-- 
Cheers, Stuart