Change lines of code inside files with Apache Ant

4

I am studying Apache Ant to try to change some lines of code inside files, but so far I have not found anything about it in the official documentation, so the maximum I can do is rename files like this example

<move todir="my/src/dir" includeemptydirs="false">
<fileset dir="my/src/dir"/>
<mapper type="glob" from="*.default.properties" to="*.local.properties"/>

I wanted to know if they have already gone through this and how can I resolve it.

    
asked by anonymous 01.08.2014 / 14:58

1 answer

4

You can use other OS executable resources and generate a task .

In your case, you could create a ant task using sed .

Another option is replaceregexp

Example:

<replaceregexp byline="true">
  <regexp pattern="OldProperty=(.*)"/>
  <substitution expression="NewProperty="/>
  <fileset dir=".">
    <include name="*.properties"/>
  </fileset>
</replaceregexp>
    
01.08.2014 / 15:07