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.

loadresource.html 2.8 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <!DOCTYPE html>
  2. <!--
  3. Licensed to the Apache Software Foundation (ASF) under one or more
  4. contributor license agreements. See the NOTICE file distributed with
  5. this work for additional information regarding copyright ownership.
  6. The ASF licenses this file to You under the Apache License, Version 2.0
  7. (the "License"); you may not use this file except in compliance with
  8. the License. You may obtain a copy of the License at
  9. https://www.apache.org/licenses/LICENSE-2.0
  10. Unless required by applicable law or agreed to in writing, software
  11. distributed under the License is distributed on an "AS IS" BASIS,
  12. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. See the License for the specific language governing permissions and
  14. limitations under the License.
  15. -->
  16. <html lang="en">
  17. <head>
  18. <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
  19. <title>LoadResource Task</title>
  20. </head>
  21. <body>
  22. <h2 id="loadresource">LoadResource</h2>
  23. <p><em>Since Apache Ant 1.7</em></p>
  24. <h3>Description</h3>
  25. <p>Load a text resource into a single property. Unless an encoding is specified, the encoding of the
  26. current locale is used. Resources to load are specified as
  27. nested <a href="../Types/resources.html">resource</a> elements or single element resource
  28. collections. If the resource content is empty (maybe after processing a <code>filterchain</code>)
  29. the property is not set.</p>
  30. <p>Since properties are immutable, the task will not change the value of an existing property.</p>
  31. <h3>Parameters</h3>
  32. <table class="attr">
  33. <tr>
  34. <th scope="col">Attribute</th>
  35. <th scope="col">Description</th>
  36. <th scope="col">Required</th>
  37. </tr>
  38. <tr>
  39. <td>property</td>
  40. <td>property to save to</td>
  41. <td>Yes</td>
  42. </tr>
  43. <tr>
  44. <td>encoding</td>
  45. <td>encoding to use when loading the resource</td>
  46. <td>No</td>
  47. </tr>
  48. <tr>
  49. <td>failonerror</td>
  50. <td>Whether to halt the build on failure</td>
  51. <td>No; default is <q>true</q></td>
  52. </tr>
  53. <tr>
  54. <td>quiet</td>
  55. <td>Do not display a diagnostic message (unless Ant has been invoked with
  56. the <kbd>-verbose</kbd> or <kbd>-debug</kbd> switches) or modify the exit status to
  57. reflect an error. Setting this to <q>true</q> implies setting <var>failonerror</var>
  58. to <q>false</q>.</td>
  59. <td>No; default is <q>false</q></td>
  60. </tr>
  61. </table>
  62. <p>The LoadResource task supports nested <a href="../Types/filterchain.html">FilterChain</a>s.</p>
  63. <h3>Examples</h3>
  64. <p>Load the entry point of Ant's homepage into property <code>homepage</code>;
  65. an <code>&lt;echo&gt;</code> can print this.</p>
  66. <pre>
  67. &lt;loadresource property="homepage"&gt;
  68. &lt;url url="https://ant.apache.org/index.html"/&gt;
  69. &lt;/loadresource&gt;</pre>
  70. <p>For more examples see the <a href="loadfile.html">loadfile</a> task.</p>
  71. </body>
  72. </html>