Hi thanks!

I had a similar idea yesterday but I was missing one part, my new solution 
(after sleeping a night about it):

    <loadresource property="maven.version.glob">
      <propertyresource name="version"/>
      <filterchain>
        <tokenfilter>
          <filetokenizer/>
          <replacestring from="-SNAPSHOT" to="-*"/>
        </tokenfilter>
      </filterchain>
    </loadresource>

I was missing <loadresource>, I only found <loadfile>, but this one does not 
allow resources. Your solution is very similar, but still more complicated and 
error prone (e.g., if the version is special and needs Unicode-escaping to be 
loaded as part of property file...).

I am testing and commiting this one, as it does not need to boot a groovy 
instance and starts up faster. I can also remove the property-pass-through to 
subants, as this one evaluates very fast and can be done in the validation task.

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: [email protected]


> -----Original Message-----
> From: Steve Rowe [mailto:[email protected]]
> Sent: Thursday, January 03, 2013 1:39 AM
> To: [email protected]
> Subject: Re: [JENKINS-MAVEN] Lucene-Solr-Maven-4.x #198: POMs out of
> sync
> 
> On Jan 2, 2013, at 5:18 PM, "Uwe Schindler" <[email protected]> wrote:
> > Unfortunately there is no way to apply a regex to a property value and
> > assign it to a new one (see e.g.,
> > http://stackoverflow.com/questions/1176071/replacing-characters-in-ant
> > -property)
> 
> I disagree.
> 
> The "get-svn-info" macro in lucene/common-build.xml converts a multi-line
> property value into a set of two other properties, by building "key=value"
> lines and interpreting them as properties file lines:
> 
> -----
> <loadproperties>
>   <propertyresource name="svn.info"/>
>   <filterchain>
>     <linecontainsregexp>
>       <regexp pattern="(URL|Revision):"/>
>     </linecontainsregexp>
>     <replacestring from=": " to="="/>
>     <prefixlines prefix="svn."/>
>   </filterchain>
> </loadproperties>
> -----
> 
> Similarly, to do regex replacement on a property value and assign the result
> to another property (untested):
> 
> -----
> <loadproperties>
>   <propertyresource name="version"/>
>   <filterchain>
>     <tokenfilter>
>       <replaceregex pattern="-SNAPSHOT" replace="-*"/>
>     </tokenfilter>
>     <prefixlines prefix="maven-version-glob="/>
>   </filterchain>
> </loadproperties>
> -----
> 
> Kinda verbose, but should do the trick.
> 
> Steve
> ---------------------------------------------------------------------
> 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