You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Petra Staub <ca...@hotmail.com> on 2011/08/14 23:55:01 UTC

Export-Package for creating a dependecy bundle





Hi all

Is it possible to create with maven-bundle-plugin nested bundles, thus a bundle holding a bunch of other bundles?
I tried to specify the dependencies in my pom.xml and create a bundle with following config:

<plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-bundle-plugin</artifactId>
    <version>2.3.5</version>
    <extensions>true</extensions>
    <configuration>
        <manifestLocation>META-INF</manifestLocation>
        <instructions>
            <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
            <Embed-Transitive>true</Embed-Transitive>
        </instructions>
        <archive>
            <addMavenDescriptor>false</addMavenDescriptor>
        </archive>
    </configuration>
</plugin>

Unfortunately the resulting MANIFEST.MF never contains the Export-Package declaration for the included bundle jars.

Thanks,
petra



 		 	   		  

Re: Export-Package for creating a dependecy bundle

Posted by Per-Erik Svensson <pe...@gmail.com>.
Just wanted to clear up the previous mail,

You should only export public api so generally <Export-Package> should only
contain things you know to be api-packages. That is, you should list the
public api packages and not export everything.

Also, this might be one of the reasons why maven-bundle-plugin choses to not
export everything that you embed automatically.

Regards,
Per-Erik Svensson

On Mon, Aug 15, 2011 at 1:24 AM, Per-Erik Svensson <
pererik.svensson@gmail.com> wrote:

> Hi Petra,
>
> According to maven-bundle documentation:
>
> "<Export-Package> is now assumed to be the set of packages in your local
> Java sources, excluding the default package '.' and any packages containing
> 'impl' or 'internal'."
>
> This is the default. That is, by default the exported packages will be all
> packages in your _source_ and that excludes any library/dependency. If you
> want to export everything than add a Export-Package tag to your pom.
>
>
> <plugin>
>    <groupId>org.apache.felix</groupId>
>    <artifactId>maven-bundle-plugin</artifactId>
>    <version>2.3.5</version>
>    <extensions>true</extensions>
>    <configuration>
>        <manifestLocation>META-INF</manifestLocation>
>        <instructions>
>            *<Export-Package>*</Export-Package>*
>
>            <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
>            <Embed-Transitive>true</Embed-Transitive>
>        </instructions>
>        <archive>
>            <addMavenDescriptor>false</addMavenDescriptor>
>        </archive>
>    </configuration>
> </plugin>
>
> I'm not going to tell you wether this is a good idea or not (brighter
> people on this list might) but my personal preference would be to OSGi-ify
> the libraries instead and install them as normal bundles into your container
> (Felix i guess). This is to avoid "I'm building a monolithic application"
> that you're trying to solve with OSGi in the first place. For example, say
> that one of your other bundles need one of the libraries that you export but
> with a newer version. To deal with that, you need to repackage your
> monolithic bundle and deploy it, possibly affecting alot of other bundles
> depending on other library packages embeded in your bundle. If the library
> was a bundle itself, only bundles actually dependent on things in that
> bundle would be affected by updates, stops and uninstalls.
>
> Generally, when modularizing, you don't want to clump existing modules
> together. That kind of defeats the purpose. :)
>
> Hope this helps!
>
> Regards,
> Per-Erik Svensson
>
>
> On Sun, Aug 14, 2011 at 11:55 PM, Petra Staub <ca...@hotmail.com> wrote:
>
>>
>>
>>
>>
>>
>> Hi all
>>
>> Is it possible to create with maven-bundle-plugin nested bundles, thus a
>> bundle holding a bunch of other bundles?
>> I tried to specify the dependencies in my pom.xml and create a bundle with
>> following config:
>>
>> <plugin>
>>    <groupId>org.apache.felix</groupId>
>>    <artifactId>maven-bundle-plugin</artifactId>
>>    <version>2.3.5</version>
>>    <extensions>true</extensions>
>>    <configuration>
>>        <manifestLocation>META-INF</manifestLocation>
>>        <instructions>
>>            <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
>>            <Embed-Transitive>true</Embed-Transitive>
>>        </instructions>
>>        <archive>
>>            <addMavenDescriptor>false</addMavenDescriptor>
>>        </archive>
>>    </configuration>
>> </plugin>
>>
>> Unfortunately the resulting MANIFEST.MF never contains the Export-Package
>> declaration for the included bundle jars.
>>
>> Thanks,
>> petra
>>
>>
>>
>>
>
>
>

Re: Export-Package for creating a dependecy bundle

Posted by Per-Erik Svensson <pe...@gmail.com>.
Hi Petra,

According to maven-bundle documentation:

"<Export-Package> is now assumed to be the set of packages in your local
Java sources, excluding the default package '.' and any packages containing
'impl' or 'internal'."

This is the default. That is, by default the exported packages will be all
packages in your _source_ and that excludes any library/dependency. If you
want to export everything than add a Export-Package tag to your pom.

<plugin>
   <groupId>org.apache.felix</groupId>
   <artifactId>maven-bundle-plugin</artifactId>
   <version>2.3.5</version>
   <extensions>true</extensions>
   <configuration>
       <manifestLocation>META-INF</manifestLocation>
       <instructions>
           *<Export-Package>*</Export-Package>*
           <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
           <Embed-Transitive>true</Embed-Transitive>
       </instructions>
       <archive>
           <addMavenDescriptor>false</addMavenDescriptor>
       </archive>
   </configuration>
</plugin>

I'm not going to tell you wether this is a good idea or not (brighter people
on this list might) but my personal preference would be to OSGi-ify the
libraries instead and install them as normal bundles into your container
(Felix i guess). This is to avoid "I'm building a monolithic application"
that you're trying to solve with OSGi in the first place. For example, say
that one of your other bundles need one of the libraries that you export but
with a newer version. To deal with that, you need to repackage your
monolithic bundle and deploy it, possibly affecting alot of other bundles
depending on other library packages embeded in your bundle. If the library
was a bundle itself, only bundles actually dependent on things in that
bundle would be affected by updates, stops and uninstalls.

Generally, when modularizing, you don't want to clump existing modules
together. That kind of defeats the purpose. :)

Hope this helps!

Regards,
Per-Erik Svensson

On Sun, Aug 14, 2011 at 11:55 PM, Petra Staub <ca...@hotmail.com> wrote:

>
>
>
>
>
> Hi all
>
> Is it possible to create with maven-bundle-plugin nested bundles, thus a
> bundle holding a bunch of other bundles?
> I tried to specify the dependencies in my pom.xml and create a bundle with
> following config:
>
> <plugin>
>    <groupId>org.apache.felix</groupId>
>    <artifactId>maven-bundle-plugin</artifactId>
>    <version>2.3.5</version>
>    <extensions>true</extensions>
>    <configuration>
>        <manifestLocation>META-INF</manifestLocation>
>        <instructions>
>            <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
>            <Embed-Transitive>true</Embed-Transitive>
>        </instructions>
>        <archive>
>            <addMavenDescriptor>false</addMavenDescriptor>
>        </archive>
>    </configuration>
> </plugin>
>
> Unfortunately the resulting MANIFEST.MF never contains the Export-Package
> declaration for the included bundle jars.
>
> Thanks,
> petra
>
>
>
>