You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by David Bosschaert <da...@gmail.com> on 2009/10/19 13:37:53 UTC
[Karaf] Not importing the exported packages
Hi all,
I came across the following in a number of pom.xml files in the Karaf build
system:
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
<Export-Package>
${pom.artifactId}*;version=${pom.version}
</Export-Package>
<Import-Package>
!${pom.artifactId}*,
... more stuff ...
</Import-Package>
</instructions>
</configuration>
</plugin>
So in the Import-Package section, the packages that exported by a the bundle
are explicitly not imported. I always thought that you should be doing the
opposite and always import what you are also exporting. See
http://www.osgi.org/blog/2007/04/importance-of-exporting-nd-importing.html
Thoughts anyone?
David
Re: [Karaf] Not importing the exported packages
Posted by Guillaume Nodet <gn...@gmail.com>.
Yeah, I do have thoughts about this thing.
The blog entry is really misleading. Take a look at
http://felix.apache.org/site/apache-felix-osgi-faq.html#ApacheFelixOSGiFAQ-Shouldabundleimportitsownexportedpackages?
but imho, it's not sufficient either.
The main point is that only when you export an api where you may have
multiple implementations, you'd want to import the packages. For a
library / implementation, you should not do that, as it causes lots of
problems when deploying multiple versions.
On Mon, Oct 19, 2009 at 13:37, David Bosschaert
<da...@gmail.com> wrote:
> Hi all,
>
> I came across the following in a number of pom.xml files in the Karaf build
> system:
>
> <plugin>
> <groupId>org.apache.felix</groupId>
> <artifactId>maven-bundle-plugin</artifactId>
> <configuration>
> <instructions>
> <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
> <Export-Package>
> ${pom.artifactId}*;version=${pom.version}
> </Export-Package>
> <Import-Package>
> !${pom.artifactId}*,
> ... more stuff ...
> </Import-Package>
> </instructions>
> </configuration>
> </plugin>
>
> So in the Import-Package section, the packages that exported by a the bundle
> are explicitly not imported. I always thought that you should be doing the
> opposite and always import what you are also exporting. See
> http://www.osgi.org/blog/2007/04/importance-of-exporting-nd-importing.html
>
> Thoughts anyone?
>
> David
>
--
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com