ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Reilly" <peter.kitt.rei...@gmail.com>
Subject Re: Can I replace some text in a fileset - using values from properties?
Date Wed, 07 Nov 2007 21:12:52 GMT
The best way is *not* to do in place replacement.
Have the templates in a source directory and the
results in a target directory, then just use
the copy task with an expandproperties filter in a filterchain:


<project name="expand" default="build">
  <property name="companyName" value="woof.com"/>
  <target name="build">
    <mkdir dir="target"/>
    <copy todir="target">
      <fileset dir="src" includes="**/*.txt"/>
      <filterchain>
        <expandproperties/>
      </filterchain>
    </copy>
  </target>
  <target name="clean">
    <delete dir="target"/>
  </target>
</project>

Peter.
On 11/7/07, Rob Wilson <netplay@gmail.com> wrote:
> Say I have a file with a few files, and would like to inject some
> values via ant properties, i.e. company.txt contains
>
> "Thank you for trying the product from ${companyName}."
>
> Is there an Ant task that given a property entry of
>
> <property name="company.txt" value="woof.com"/>
>
> Will result in company.txt containing
>
> "Thank you for trying the product from woof.com"
>
> Thanks,
> Rob.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message