You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Stuart McCulloch <mc...@gmail.com> on 2009/01/28 14:54:58 UTC
Re: Export-Package header declaration for Felix Maven-Bundle-Plugin
has unexpected behaviour
2009/1/28 Florian Rampp <Fl...@web.de>
> Hello!
>
> I'm using the Maven-Bundle-Plugin and having problems with specifying
> export-package and import-package.
>
> Since my package structure in java does not fit the default export-package
> (<groupId>.<artifactId>.*), I specify this on my own:
> <plugin>
> <groupId>org.apache.felix</groupId>
> <artifactId>maven-bundle-plugin</artifactId>
> <extensions>true</extensions>
> <configuration>
> <instructions>
> <Export-Package>deus.model.*</Export-Package>
> </instructions>
> </configuration>
> </plugin>
>
> The effect is, that all packages are exported (good!) and that also, all
> packages contained in the bundle appear in the field Import-Package,
> although, they are contained in the bundle (not so good).
> Why?
>
> If I exclude the packages from this bundle from importing:
> <plugin>
> <groupId>org.apache.felix</groupId>
> <artifactId>maven-bundle-plugin</artifactId>
> <extensions>true</extensions>
> <configuration>
> <instructions>
> <Export-Package>deus.model.*</Export-Package>
> <Import-Package>!deus.model.*,*</Import-Package>
> </instructions>
> </configuration>
> </plugin>
>
> All packages being in Import-Package before now appear in the header
> Ignore-Package (it's getting worse...). What is this header for?
> I can't imagine how to simply export all classes of my package while not
> importing the packages contained in the bundle.
>
> To further complicate this (actually not so complicated) issue, I would
> like to prevent everything inside an "impl" package from getting exported.
> How to do this?
> <Export-Package>!*.impl,deus.model.*</ExportPackage>
> would fit my needs perfectly, but it looks like the wildcard * is only
> recognized at the end of a package path pattern.
>
> I would really be glad, if somebody could help me, these issues really
> drive me crazy.
>
re. your exports also being imported - this is a specific feature of the Bnd
Tool, see:
http://www.osgi.org/blog/2007/04/importance-of-exporting-nd-importing.html
as well as:
http://aqute.biz/Code/Bnd#export-package
which explains how to turn this off (add -noimport:=true as an attribute on
the package)
but importing your exports shouldn't cause any problems - on the contrary it
solves them!
Ignore-Package is just a 'helper/documentation' entry so you can see what
packages the
Bnd Tool ignored (same as the Include-Resource and Private-Package entries)
these can
be removed from the final bundle as the OSGi framework doesn't use them - if
you want to
remove them use the <_removeheaders> instruction, also documented on the Bnd
site.
the Bnd site also explains how Export-Package is processed (left to right)
... so to export
your public API but not your implementation packages, use something like the
following:
<Export-Package>!deus.model.impl.*,deus.model.*"</Export-Package>
<Private-Package>deus.model.impl.*</Private-Package>
HTH
Thanks a lot!
>
> Florian
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
--
Cheers, Stuart