Ant load properties from pattern
In ant, I need to load a set of .properties
files based on a pattern.
<property>
<fileset includes="${propertiesDir}/*.properties"/>
</property>
but it doesn't work because <property>
doesn't support nesting.
How can i load proper开发者_开发百科ties from files matching a pattern?
Thanks..
You could use the concat
task to concat all your properties files to a big temporary properties file, and the use property
with this big temporary properties file as attribute.
Make sure to use fixlastline="true" with the concat task to make sure each file ends with a new line character.
Example :
<target name="init">
<concat destfile="temp/bigPropertiesFile.properties" fixlastline="true">
<fileset dir="${propertiesDir}" includes="*.properties"/>
</concat>
<property file="temp/bigPropertiesFile.properties"/>
</target>
精彩评论