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. Since Ant 1.8.1 No; default is .
prefixValues Whether to apply the prefix when expanding the right hand side of the properties. Since Ant 1.8.2 No; default is true

Parameters specified as nested elements

any resource or single element resource collection

Since Ant 1.7

The specified resource will be used as srcFile or resource.



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.