I have two property files [one.properties
and two.properties
]. I want to dynamically load the property files into my Ant project from the command line.
My build file name is build.xml.
Command line:
> ant build [How do I pass the property file names here?]
ant -propertyfile one.properties -propertyfile two.properties
Individual properties may be defined on the command line with the -D
flag:
ant -Dmy.property=42
<loadproperties srcfile="one.properties" />
<loadproperties srcfile="two.properties" />
<property file="one.properties" />
<property file="two.properties" />
JB Nizet's solution combines concat with fileset:
<target name="init" description="Initialize the project.">
<mkdir dir="temp" />
<concat destfile="temp/combined.properties" fixlastline="true">
<fileset dir="." includes="*.properties" />
</concat>
<property file="temp/combined.properties" />
</target>
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