You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Konrad Windszus <ko...@netcentric.biz> on 2016/01/25 09:55:19 UTC
Moving from Bnd SemVer annotations to OSGi annotations
Hi,
currently we are relying on the bnd annotations for semantic versioning.
Since OSGi 6.0 there are also official annotations defined in package “org.osgi.annotation.versioning". This package is provided by
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.annotation</artifactId>
<version>6.0.0</version>
</dependency>
Since version 3.0 those annotations are also understood by bndlib (used since maven-bundle-plugin 3.0), see https://github.com/bndtools/bnd/issues/484 <https://github.com/bndtools/bnd/issues/484>.
Since this would only mean a compile time dependency requirement on maven-bundle-plugin >= 3.0 I think we should encourage the switch from one package to the other.
WDYT?
Konrad
Re: Moving from Bnd SemVer annotations to OSGi annotations
Posted by Oliver Lietz <ap...@oliverlietz.de>.
On Monday 25 January 2016 11:46:57 Konrad Windszus wrote:
> Hi Oliver,
> I would not recommend to already rely on the metatype annotations from OSGi
> as those will only generate metatype 1.3 files (runtime dependency) with
> with maven-bundle-plugin 3.0.1 (https://github.com/bndtools/bnd/issues/1183
> <https://github.com/bndtools/bnd/issues/1183>). Therefore those components
> are then no longer compatible with an older Sling version (or with AEM 6.0
> or 6.1). But at least the move towards the semantic versioning annotations
> should be safe as there are IMHO no known issues with maven-bundle-plugin
> 3.0.1 and there is definitely no runtime implication on the switch.
I see you have hit several issues also... :/ BND-1183 is fixed for 3.1.0 which
will be used by Maven Bundle Plugin 3.0.2. Should we just wait for 3.0.2
release?
> The only thing I am not too sure about is about the dependency:
> I would like to add
>
> >> <dependency>
> >>
> >> <groupId>org.osgi</groupId>
> >> <artifactId>org.osgi.annotation</artifactId>
> >> <version>6.0.0</version>
> >>
> >> </dependency>
>
> in the parent pom and get rid of the bndlib dependency!
> Otherwise you would have the same classname twice in the class path (as both
> OSGi and bnd semantic versioning annotations share the same class name, but
> of course in different packages). Do you see any problems with that step?
I don't have a problem with having multiple classes with same name (AFAIR
we've multiple classes named Resource) in the class path but I know some
developers have. What about removing bndlib from parent and see what fails?
> What other packages are used from the bndlib dependency except for the
> SemVer annotations?
Not sure about the packages but bndlib (2.4) is also used by our Pax Exam
tests.
Regards,
O.
> Konrad
>
> > On 25 Jan 2016, at 11:34, Oliver Lietz <ap...@oliverlietz.de> wrote:
> >
> > On Monday 25 January 2016 09:55:19 Konrad Windszus wrote:
> >> Hi,
> >
> > Hi Konrad,
> >
> >> currently we are relying on the bnd annotations for semantic versioning.
> >> Since OSGi 6.0 there are also official annotations defined in package
> >> âorg.osgi.annotation.versioning". This package is provided by
> >> <dependency>
> >>
> >> <groupId>org.osgi</groupId>
> >> <artifactId>org.osgi.annotation</artifactId>
> >> <version>6.0.0</version>
> >>
> >> </dependency>
> >>
> >> Since version 3.0 those annotations are also understood by bndlib (used
> >> since maven-bundle-plugin 3.0), see
> >> https://github.com/bndtools/bnd/issues/484
> >> <https://github.com/bndtools/bnd/issues/484>. Since this would only mean
> >> a
> >> compile time dependency requirement on maven-bundle-plugin >= 3.0 I think
> >> we should encourage the switch from one package to the other. WDYT?
> >
> > we should switch to OSGi annotations but not only for versioning. This can
> > be done one by one and needs not to be done for all modules at once
> > (compile time/tooling only). I've done the switch for Scripting
> > Thymeleaf[1] already. But be prepared - bumpy road ahead, see e.g.
> > BND-1030 or BND-1266.
> >
> > Regards,
> > O.
> >
> > [1]
> > https://github.com/apache/sling/blob/trunk/contrib/scripting/org.apache.sl
> > ing.scripting.thymeleaf/pom.xml>
> >> Konrad
Re: Moving from Bnd SemVer annotations to OSGi annotations
Posted by Konrad Windszus <ko...@gmx.de>.
Hi Oliver,
I would not recommend to already rely on the metatype annotations from OSGi as those will only generate metatype 1.3 files (runtime dependency) with with maven-bundle-plugin 3.0.1 (https://github.com/bndtools/bnd/issues/1183 <https://github.com/bndtools/bnd/issues/1183>). Therefore those components are then no longer compatible with an older Sling version (or with AEM 6.0 or 6.1).
But at least the move towards the semantic versioning annotations should be safe as there are IMHO no known issues with maven-bundle-plugin 3.0.1 and there is definitely no runtime implication on the switch.
The only thing I am not too sure about is about the dependency:
I would like to add
>> <dependency>
>> <groupId>org.osgi</groupId>
>> <artifactId>org.osgi.annotation</artifactId>
>> <version>6.0.0</version>
>> </dependency>
in the parent pom and get rid of the bndlib dependency!
Otherwise you would have the same classname twice in the class path (as both OSGi and bnd semantic versioning annotations share the same class name, but of course in different packages).
Do you see any problems with that step? What other packages are used from the bndlib dependency except for the SemVer annotations?
Konrad
> On 25 Jan 2016, at 11:34, Oliver Lietz <ap...@oliverlietz.de> wrote:
>
> On Monday 25 January 2016 09:55:19 Konrad Windszus wrote:
>> Hi,
>
> Hi Konrad,
>
>> currently we are relying on the bnd annotations for semantic versioning.
>> Since OSGi 6.0 there are also official annotations defined in package
>> “org.osgi.annotation.versioning". This package is provided by <dependency>
>> <groupId>org.osgi</groupId>
>> <artifactId>org.osgi.annotation</artifactId>
>> <version>6.0.0</version>
>> </dependency>
>>
>> Since version 3.0 those annotations are also understood by bndlib (used
>> since maven-bundle-plugin 3.0), see
>> https://github.com/bndtools/bnd/issues/484
>> <https://github.com/bndtools/bnd/issues/484>. Since this would only mean a
>> compile time dependency requirement on maven-bundle-plugin >= 3.0 I think
>> we should encourage the switch from one package to the other. WDYT?
>
> we should switch to OSGi annotations but not only for versioning. This can be
> done one by one and needs not to be done for all modules at once (compile
> time/tooling only). I've done the switch for Scripting Thymeleaf[1] already.
> But be prepared - bumpy road ahead, see e.g. BND-1030 or BND-1266.
>
> Regards,
> O.
>
> [1]
> https://github.com/apache/sling/blob/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf/pom.xml
>
>> Konrad
>
Re: Moving from Bnd SemVer annotations to OSGi annotations
Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi Konrad,
On Mon, Jan 25, 2016 at 6:02 PM, Konrad Windszus <ko...@gmx.de> wrote:
> ...bnd supports both type of annotations...
Ok, thanks for clarifying!
> The only question is whether to still support both (by leaving both artifacts in the class path) or by removing the
> bndlib dependency from the parent pom (and therefore do no longer allow to use the bnd annotations without
> explicitly defining bndlib as module dependency). That way we make the build fail in case the bnd annotations
> are used but not defined as dependency....
We should ultimately do that IMO, and maybe as a first step just
deprecate the use of those annotations (unless we did that already).
-Bertrand
Re: Moving from Bnd SemVer annotations to OSGi annotations
Posted by Konrad Windszus <ko...@gmx.de>.
Hi Bertrand,
> On 25 Jan 2016, at 17:58, Bertrand Delacretaz <bd...@apache.org> wrote:
>
> Hi,
>
> On Mon, Jan 25, 2016 at 11:34 AM, Oliver Lietz <ap...@oliverlietz.de> wrote:
>> ...we should switch to OSGi annotations but not only for versioning....
>
> I'd like us to consider backwards compatibility when doing this: if my
> code still uses annotation A and we start using B now, code that uses
> A should cause loud breakages instead of A being silently ignored.
That will never happen as bnd supports both type of annotations.
The only question is whether to still support both (by leaving both artifacts in the class path) or by removing the bndlib dependency from the parent pom (and therefore do no longer allow to use the bnd annotations without explicitly defining bndlib as module dependency). That way we make the build fail in case the bnd annotations are used but not defined as dependency.
>
> -Bertrand
Konrad
Re: Moving from Bnd SemVer annotations to OSGi annotations
Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi,
On Mon, Jan 25, 2016 at 11:34 AM, Oliver Lietz <ap...@oliverlietz.de> wrote:
> ...we should switch to OSGi annotations but not only for versioning....
I'd like us to consider backwards compatibility when doing this: if my
code still uses annotation A and we start using B now, code that uses
A should cause loud breakages instead of A being silently ignored.
-Bertrand
Re: Moving from Bnd SemVer annotations to OSGi annotations
Posted by Oliver Lietz <ap...@oliverlietz.de>.
On Monday 25 January 2016 09:55:19 Konrad Windszus wrote:
> Hi,
Hi Konrad,
> currently we are relying on the bnd annotations for semantic versioning.
> Since OSGi 6.0 there are also official annotations defined in package
> “org.osgi.annotation.versioning". This package is provided by <dependency>
> <groupId>org.osgi</groupId>
> <artifactId>org.osgi.annotation</artifactId>
> <version>6.0.0</version>
> </dependency>
>
> Since version 3.0 those annotations are also understood by bndlib (used
> since maven-bundle-plugin 3.0), see
> https://github.com/bndtools/bnd/issues/484
> <https://github.com/bndtools/bnd/issues/484>. Since this would only mean a
> compile time dependency requirement on maven-bundle-plugin >= 3.0 I think
> we should encourage the switch from one package to the other. WDYT?
we should switch to OSGi annotations but not only for versioning. This can be
done one by one and needs not to be done for all modules at once (compile
time/tooling only). I've done the switch for Scripting Thymeleaf[1] already.
But be prepared - bumpy road ahead, see e.g. BND-1030 or BND-1266.
Regards,
O.
[1]
https://github.com/apache/sling/blob/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf/pom.xml
> Konrad