lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Rowe <sar...@gmail.com>
Subject Re: [JENKINS-MAVEN] Lucene-Solr-Maven-4.x #198: POMs out of sync
Date Thu, 03 Jan 2013 00:39:05 GMT
On Jan 2, 2013, at 5:18 PM, "Uwe Schindler" <uwe@thetaphi.de> 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: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message