将文件内容加载为 Apache Ant 属性。这等同于 <property file|resource=,但它支持嵌套的 ...
/><filterchain> 元素。此外,如果文件丢失,构建将因错误而停止,而不是打印警告。
注意:此任务的 prefixValues 属性的默认值与 <property> 任务中相同属性的默认值不同。
| 属性 | 描述 | 必需 |
|---|---|---|
| srcFile | 源文件 | 这些属性之一或嵌套资源 |
| resource | 属性文件的资源名称 | |
| encoding | 加载文件时使用的编码 | 否 |
| classpath | 查找资源时使用的类路径。 | 否 |
| classpathref | 查找资源时使用的类路径,以对在其他地方定义的 <path> 的 引用 形式给出。 |
否 |
| prefix | 应用于已加载属性的前缀。自 Ant 1.8.1 起 | 否;默认值为 . |
| prefixValues | 在扩展属性的右侧时是否应用前缀。自 Ant 1.8.2 起 | 否;默认值为 true |
自 Ant 1.7 起
指定的资源将用作 srcFile 或 resource。
用于 resource 属性。
将 file.properties 的内容加载为 Ant 属性。
<loadproperties srcFile="file.properties"/>
或
<loadproperties>
<file file="file.properties"/>
</loadproperties>
从 file.properties 文件中读取包含字符串 import.
的行,并将它们加载为 Ant 属性。
<loadproperties srcFile="file.properties">
<filterchain>
<linecontains>
<contains value="import."/>
</linecontains>
</filterchain>
</loadproperties>
加载 https://example.org/url.properties.gz 的内容,动态解压缩它,并将内容加载为 Ant 属性。
<loadproperties>
<gzipresource>
<url url="https://example.org/url.properties.gz"/>
</gzipresource>
</loadproperties>