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>
I did it like this:
<property prefix="app.properties" file="custom.application.properties" />
<property prefix="app.properties" file="default.application.properties" />
<echoproperties destfile="application.properties">
<propertyset>
<propertyref prefix="app.properties"/>
<mapper type="glob" from="app.properties.*" to="*"/>
</propertyset>
</echoproperties>
Perhaps you should look at the concat task of ant for this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With