Using Ant to merge two different properties files

Posted by Justin on Stack Overflow See other posts from Stack Overflow or by Justin
Published on 2011-01-05T04:48:01Z Indexed on 2011/01/05 4:53 UTC
Read the original article Hit count: 299

Filed under:
|
|
|
|

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>

© Stack Overflow or respective owner

Related posts about ant

Related posts about build