title: Using Ant to merge two different properties files
body: <p>I have a default properties file, and some deployment specific properties files that override certain settings from the default, based on deployment environment. I would like my Ant build script to merge the two properties files (overwriting default values with deployment specific values), and then output the resulting properties to a new file. </p>
  
  <p>I tried doing it like so but I was unsuccessful:</p>
  
  <pre><code>&lt;target depends="init" name="configure-target-environment"&gt;
      &lt;filterset id="application-properties-filterset"&gt;
          &lt;filtersfile file="${build.config.path}/${target.environment}/application.properties" /&gt;
      &lt;/filterset&gt;
  
      &lt;copy todir="${web-inf.path}/conf" file="${build.config.path}/application.properties" overwrite="true" failonerror="true" &gt;
          &lt;filterset refid="application-properties-filterset" /&gt;
      &lt;/copy&gt;
  &lt;/target&gt;
  </code></pre>