1

In ant, I need to load a set of .properties files based on a pattern.
I tried:

<property>  
    <fileset includes="${propertiesDir}/*.properties"/>
</property>

but it doesn't work because <property> doesn't support nesting.

How can i load properties from files matching a pattern?

Thanks..

alem0lars
  • 660
  • 2
  • 10
  • 23

1 Answers1

2

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>
JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255