felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stuart McCulloch <mccu...@gmail.com>
Subject Re: maven-bundle-plugin and .impl and .internal packages
Date Sun, 01 May 2011 22:54:37 GMT
On 1 May 2011 17:37, Yuri de Wit <ydewit@gmail.com> wrote:

> Thanks for the answer, Stuart.
>
> I did read the documentation and followed the instructions there, but
> although I had an Export-Package setting it was not being picked up.
>
> It turns out that the issue had nothing to do with
> maven-bundle-plugin, but self-inflicted with a little "help" from
> maven. I had the plugin configured twice in my parent pom's
> pluginManagement (it's a few pages long) and maven was silently
> ignoring the first one, which had all the settings. In my bundle
> configuration I had:
>
>
> <Export-Package>!${project.groupId}.${project.artifactId}.internal.*,${project.groupId}.${project.artifactId}.*</Export-Package>
>
> <Private-Package>${project.groupId}.${project.artifactId}.internal.*</Private-Package>
>
> Removing the dup one fixed the problem.
>

FYI, I find "mvn help:effective-pom" helps to solve these sorts of problems,
since it shows you the final merged pom


> I also added a bit of logging to BundlePlugin and ManifestPlugin to
> help track what it is actually doing and double check it was doing
> what I wanted:
>

Cool - we already do some logging of what gets sent to bnd and what comes
back, but you need to add "-X" to see it

(unfortunately this also produces a lot of other maven related debug output)


> [INFO] Writting MANIFEST.MF to
> /Users/joe/Workspaces/hello/hello.bundles/hello.core/META-INF/MANIFEST.MF
> ...
>
> thanks,
> -- yuri
>
> On Sun, May 1, 2011 at 7:52 AM, Stuart McCulloch <mcculls@gmail.com>
> wrote:
> > On 30 April 2011 23:47, Yuri de Wit <ydewit@gmail.com> wrote:
> >
> >> I have been going in circles trying to figure out why certain packages
> >> weren't being exported until I noticed, after taking a look at the
> >> sources, that the maven-bundle-plugin seems to be skipping .impl and
> >> .internal packages.
> >
> >
> > That's correct - if you don't define any Export-Package then it defaults
> to
> > the local non-internal / non-impl packages, as described in the "Default
> > Behavior" section:
> >
> >   http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html
> >
> > After I renamed my package to something else it
> >> worked as expected.
> >>
> >> Is this restriction imposed by the OSGi specs? Although in theory
> >> .impl means an internal package it is not always the case. Renaming
> >> the package is an option, but seems a bit invasive (specially without
> >> knowing a good reason for it to be the way it is). Last, is there a
> >> simple work around for this beyond renaming the package?
> >>
> >
> > There is nothing in the specs that restrict implementation packages from
> > being exported, the bundleplugin defaults are based on user feedback
> > and current best-practice. But they are only defaults - if you want to
> > export internal packages then you can do so by explicitly setting
> > Export-Package (or _exportcontents if you're exporting packages from
> > embedded JARs, see the above link and FAQ for more details).
> >
> > Though ideally you wouldn't want to export implementation packages, since
> > one benefit of modularity is that you can hide away internal /
> > implementation details and instead communicate via interfaces and
> services.
> > That way you get loose coupling, and substitutable bundles.
> >
> >
> >> -- yuri
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> >> For additional commands, e-mail: users-help@felix.apache.org
> >>
> >
> > --
> > Cheers, Stuart
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message