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]