Load a file's contents as Apache Ant properties. This is equivalent to <property file|resource="..."/> except that it supports nested <filterchain> elements. Also if the file is missing, the build is halted with an error, rather than a warning being printed.

Note: the default value of this task's prefixValues attribute is different from the default value of the same attribute in the <property> task.


Attribute Description Required
srcFile source file One of these or a nested resource
resource the resource name of the property file
encoding encoding to use when loading the file No
classpath the classpath to use when looking up a resource. No
classpathref the classpath to use when looking up a resource, given as reference to a <path> defined elsewhere.. No
prefix Prefix to apply to loaded properties; a "." is appended to the prefix if not specified. Since Ant 1.8.1 No
prefixValues Whether to apply the prefix when expanding the right hand side of the properties. Since Ant 1.8.2 No (default=true)

Parameters specified as nested elements

any resource or single element resource collection

The specified resource will be used as src. Since Ant 1.7



for use with the resource attribute.


    <loadproperties srcFile="file.properties"/>
      <file file="file.properties"/>
Load contents of file.properties as Ant properties.
    <loadproperties srcFile="file.properties">
          <contains value="import."/>
Read the lines that contain the string "import." from the file "file.properties" and load them as Ant properties.
        <url url="http://example.org/url.properties.gz"/>
Load contents of http://example.org/url.properties.gz, uncompress it on the fly and load the contents as Ant properties.