directory-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Seelmann <m...@stefan-seelmann.de>
Subject Re: Request for slf4j import package in API bundles changes
Date Wed, 15 Apr 2015 21:43:19 GMT
On 04/15/2015 08:43 AM, Stefan Seelmann wrote:
> On 04/08/2015 10:57 PM, Benjamin Abernathy wrote:
>> Stefan,
>>
>> I think I have found a reasonable solution. I implemented it and it
>> passes the integration tests as well as solves the problem I am
>> experiencing in OSGi. Here is what I did.
>>
>> 1. I updated the parent pom by adding the following properties:
>>
>>     <slf4j.api.version.min>1.7</slf4j.api.version.min>
>>     <slf4j.api.version.max>1.8</slf4j.api.version.max>
>>
>> 2. Then in each child pom that had an import declaration for org.slf4j,
>> I changed the import statement from:
>>
>> org.slf4j;version=${slf4j.api.version},
>>
>> to: 
>>
>> org.slf4j;version="[${slf4j.api.version.min},${slf4j.api.version.max})",
>>
>>
>> This approach has some drawbacks:
>>
>> 1. You now have three places that may need to be updated when the
>> version of slf4j is updated. 
>> 2. BND (which is called by maven-bundle-plugin) is not the one deciding
>> the what version should be used.
>>
>> Now, supposedly BND can choose a version range, but I could not get
>> consistent behavior from the build using that approach.
> 
> You mean the following? I tried to use BND range macro which magically
> works:
> 
>     org.slf4j;version="$«range;[==,=+)»",
> 
> The result in mainifest is then org.slf4j;version="[1.7,1.8)"
> 
> But I didn't find lot of documenation why it works. And the maven build
> prints out a warning (but still it works):
> 
> [INFO] --- maven-bundle-plugin:2.5.3:bundle (default-bundle) @
> api-ldap-model ---
> [WARNING] Bundle
> org.apache.directory.api:api-ldap-model:bundle:1.0.0-M30-SNAPSHOT : No
> translation found for macro: range;[==,=+), in
> 

I think I finally found a good solution.

In parent pom I added a property that defines the range macro

  <slf4j.api.bundleversion>"$«range;[==,=+)»"</slf4j.api.bundleversion>

And in the actual poms the Import-Package instruction just looks like this

  org.slf4j;version=${slf4j.api.bundleversion},

So in case the macro magic makes problems we just have to change the
property in parent pom. All tests (API, ApacheDS, Studio) work fine,
I'll commit the changes tomorrow.

Kind Regards,
Stefan


Mime
View raw message