You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

loadproperties.html 2.7 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <html>
  2. <head>
  3. <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
  4. <title>LoadProperties Task</title>
  5. </head>
  6. <body>
  7. <h2><a name="loadproperties">LoadProperties</a></h2>
  8. <h3>Description</h3>
  9. <p>
  10. Load a file's contents as Ant properties. This is equivalent
  11. to <code>&lt;property file|resource=&quot;...&quot;/&gt;</code> except that it
  12. supports nested <code>&lt;filterchain&gt;</code> elements.
  13. Also if the file is missing, the build is halted with an error, rather
  14. than a warning being printed.
  15. </p>
  16. <p>If you want to simulate <a href="property.html">property</a>'s
  17. prefix attribute, please use <a
  18. href="../CoreTypes/filterchain.html#prefixlines">prefixlines</a>
  19. filter.</p>
  20. <h3>Parameters</h3>
  21. <table border="1" cellpadding="2" cellspacing="0">
  22. <tr>
  23. <td valign="top"><b>Attribute</b></td>
  24. <td valign="top"><b>Description</b></td>
  25. <td align="center" valign="top"><b>Required</b></td>
  26. </tr>
  27. <tr>
  28. <td valign="top">srcFile</td>
  29. <td valign="top">source file</td>
  30. <td valign="top" rowspan="2" align="center">One of these</td>
  31. </tr>
  32. <tr>
  33. <td valign="top">resource</td>
  34. <td valign="top">the resource name of the property file</td>
  35. </tr>
  36. <tr>
  37. <td valign="top">encoding</td>
  38. <td valign="top">encoding to use when loading the file</td>
  39. <td align="center" valign="top">No</td>
  40. </tr>
  41. <tr>
  42. <td valign="top">classpath</td>
  43. <td valign="top">the classpath to use when looking up a resource.</td>
  44. <td align="center" valign="top">No</td>
  45. </tr>
  46. <tr>
  47. <td valign="top">classpathref</td>
  48. <td valign="top">the classpath to use when looking up a resource,
  49. given as <a href="../using.html#references">reference</a>
  50. to a <code>&lt;path&gt;</code> defined elsewhere..</td>
  51. <td align="center" valign="top">No</td>
  52. </tr>
  53. </table>
  54. <p>
  55. The LoadProperties task supports nested <a href="../CoreTypes/filterchain.html">
  56. FilterChain</a>s, as well as a nested <code>&lt;classpath&gt;</code>
  57. element for use with the <i>resource</i> attribute.
  58. <h3>Examples</h3>
  59. <pre> &lt;loadproperties srcFile="file.properties"/&gt;
  60. </pre>
  61. Load contents of file.properties as Ant properties.
  62. <pre> &lt;loadproperties srcFile="file.properties"&gt;
  63. &lt;filterchain&gt;
  64. &lt;<a href="../CoreTypes/filterchain.html#linecontains">linecontains</a>&gt;
  65. &lt;contains value=&quot;import.&quot;/&gt;
  66. &lt;/linecontains&gt;
  67. &lt;/filterchain&gt;
  68. &lt;/loadproperties&gt;
  69. </pre>
  70. Read the lines that contain the string &quot;import.&quot;
  71. from the file &quot;file.properties&quot; and load them as
  72. Ant properties.
  73. <hr>
  74. <p align="center">Copyright &copy; 2002-2005 The Apache Software Foundation. All rights
  75. Reserved.</p>
  76. </body>
  77. </html>