You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Henri Yandell <fl...@gmail.com> on 2008/01/02 02:55:21 UTC

Re: Support for OSGi

On Dec 28, 2007 4:35 AM, Carsten Ziegeler <cz...@apache.org> wrote:
> Hi,
>
> in the meantime Stuart fixed the problem with the maven bundleplugin, so
> I think we can give it a test drive :)
>
> Attached is a patch for the parent pom of commons and one to demonstrate
> how to add support for OSGi to commons-lang.
>
> The changes to the parent pom are minimal: it just adds the maven
> bundleplugin from the Apache Felix project. We currently need to use a
> snapshot version, but a release is comming soon.
> Besides adding the plugin, the patch also configures the bundle symbolic
> name for all modules. The symbolic name is the unique identifier which
> should follow java package naming. The best value is to use something
> like "org.apache.commons.{artifactId}" where artifact id is commons-lang
> or commons-collections etc.
>
> The patch to commons lang is also very simple. It changes the parent pom
> to the current snapshot (which includes the changes from above) and sets
> the packaging to bundle - this ensures that the bundleplugin runs and
> creates the resulting jar file. So the bundleplugin replaces the maven
> jar plugin. If you leave the packaging as "jar" the bundleplugin will
> not run.
> The last part of the patch adds the configuration to the bundleplugin.
> The export "*" exports all packages definied in this module for other
> bundles, so all classes are public. All packages are marked with the
> current version which allows to run different versions in parallel.
> The imports are not specified as they are calculated automatically by
> the bundleplugin.

Guess that means Lang should start using m2 and not m1 for the release :)

Dumb question - why does anything need to be added to the child pom?
Can't it all go in the parent pom?

Hen

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: Support for OSGi

Posted by Carsten Ziegeler <cz...@apache.org>.
Henri Yandell wrote:
> 
> Guess that means Lang should start using m2 and not m1 for the release :)
:)

It's also possible to add the meta information to the jar "by hand". So
you could look at the result of the m2 build and then add the manifest
entries by hand using the m1 build - it's not that flexible and elegant
but working as well :)

> 
> Dumb question - why does anything need to be added to the child pom?
> Can't it all go in the parent pom?
Yes, that's actually a good question :)
For libraries like lang or collections the changes to the pom will all
look the same. You define the exports of the library by exporting all
contained classes.
For other products at commons this might be different as not all
contained classes might be meant to be public, so you would only export
the public packages (api and util classes) while you would not export
private packages (implementations). In these cases each project has to
explicitly declare the public and the private packages.

But we could move the default (exporting everything) to the parent pom
and then the only change would be to change the packaging from jar to
bundle in each project.

Carsten


-- 
Carsten Ziegeler
cziegeler@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org