On 30 Aug 2011, at 13:38, Benson Margulies wrote:

> On Tue, Aug 30, 2011 at 6:32 AM, Stuart McCulloch <[email protected]> wrote:
>> On 29 August 2011 17:43, Benson Margulies <[email protected]> wrote:
>> 
>>> I got the following by attempting to map this into the maven plugin.
>>> 
>>> 1.0.0.orgapachemavenmodelBuild43ce663c
>>> 
>>> Is this right? It's not quite what I expected.
>>> 
>>> I used:
>>> 
>>>   <build>\${tstamp}</build>
>>>   <!-- hmm, has to be updated for releases -->
>>>   <Bundle-Version>1.0.0.\${build}</Bundle-Version>
>> 
>> 
>> looks like maven is interpolating the ${build} variable as ${project.build}
>> using the Maven model
> 
> Here's what worked:
> 
>                       <stamp>$${tstamp}</stamp>
>                       <!-- hmm, has to be updated for releases -->
>                       <Bundle-Version>1.0.0.${stamp}</Bundle-Version>
> 
> Notice that I had to escape the first, and not the second. I haven't
> look at the java source of the plugin to see if I can explain this.

I doubt looking at the bundleplugin source would help, since this is related to 
stock Maven interpolation which is applied before the bundleplugin executes

I generally use round brackets for bnd macros and properties to make sure that 
Maven isn't going to touch them

> 
>> 
>> bnd supports use of other brackets, so you could use round brackets instead
>> to stop Maven from doing its interpolation:
>> 
>>   <Bundle-Version>1.0.0.$(tstamp)</Bundle-Version>
>> 
>> or if you still want to use an intermediate variable:
>> 
>>    <build>$(tstamp)</build>
>>    <Bundle-Version>1.0.0.$(build)</Bundle-Version>
>> 
>> bnd also supports macros (http://www.aqute.biz/Bnd/Macros) so you can also
>> do things like:
>> 
>> 
>>  
>> <Bundle-Version>$(replace;${project.version};-SNAPSHOT;.$(tstamp))</Bundle-Version>
>> 
>> to avoid the issue with OSGi versions that 1.0.0 is earlier than
>> 1.0.0.20110830 you could use:
>> 
>> 
>> <qualifier>$(if;$(filter;$(project.version);.*-SNAPSHOT);v$(tstamp);GA)</qualifier>
>> 
>> <Bundle-Version>$(replace;$(project.version);^(.*?)(-SNAPSHOT)?$;$1.$(qualifier))</Bundle-Version>
>> 
>> which will use "v$(tstamp)" as the qualifier for snapshot versions, and "GA"
>> for the final release
>> 
>> but we could definitely make this easier by providing a simple switch in the
>> plugin - so if anyone has time to whip up a path, feel free...
>> 
>> On Mon, Aug 29, 2011 at 8:50 AM, Marcel Offermans
>>> <[email protected]> wrote:
>>>> On 29 Aug 2011, at 14:43 , Benson Margulies wrote:
>>>> 
>>>>> The eclipse ecosystem seems to like to use 'qualifier' as a qualifier
>>>>> to spit out a unique number. Can I do that in the plugin by explicitly
>>>>> specifying 'qualifier' in the instructions?
>>>> 
>>>> The Bnd instructions for this are:
>>>> 
>>>> build = ${tstamp}
>>>> Bundle-Version: 1.0.0.${build}
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [email protected]
>>>> For additional commands, e-mail: [email protected]
>>>> 
>>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>> 
>>> 
>> 
>> 
>> --
>> Cheers, Stuart
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to