Using Ant to merge two different properties files
- by Justin
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.
I tried doing it like so but I was unsuccessful:
<target depends="init" name="configure-target-environment">
<filterset id="application-properties-filterset">
<filtersfile file="${build.config.path}/${target.environment}/application.properties" />
</filterset>
<copy todir="${web-inf.path}/conf" file="${build.config.path}/application.properties" overwrite="true" failonerror="true" >
<filterset refid="application-properties-filterset" />
</copy>
</target>