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.

echoproperties.html 3.5 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
  5. <title>Echoproperties Task</title>
  6. </head>
  7. <body>
  8. <h2><a name="echoproperties">echoproperties</a></h2>
  9. <h3>Description</h3>
  10. <p>Displays all the current properties (or a subset of them specified
  11. by a nested <code>&lt;propertyset&gt;</code>) in the project. The
  12. output can be sent to a file if desired. This task can be used as a
  13. somewhat contrived means of returning data from an
  14. <tt>&lt;ant&gt;</tt> invocation, but is really for debugging build
  15. files.</p>
  16. <h3>Parameters</h3>
  17. <table border="1" cellpadding="2" cellspacing="0">
  18. <tr>
  19. <td valign="top"><b>Attribute</b></td>
  20. <td valign="top"><b>Description</b></td>
  21. <td align="center" valign="top"><b>Required</b></td>
  22. </tr>
  23. <tr>
  24. <td valign="top">destfile</td>
  25. <td valign="top">If specified, the value indicates the name of the
  26. file to send the output of the statement to. The generated output file
  27. is compatible for loading by any Java application as a property file.
  28. If not specified, then the output will go to the Ant log.</td>
  29. <td valign="top" align="center">No</td>
  30. </tr>
  31. <tr>
  32. <td valign="top">prefix</td>
  33. <td valign="top">
  34. a prefix which is used to filter the properties
  35. only those properties starting with this prefix will be echoed.
  36. <P>
  37. </td>
  38. <td valign="top" align="center">No</td>
  39. </tr>
  40. <tr>
  41. <td valign="top">failonerror</td>
  42. <td valign="top">By default, the "failonerror" attribute is enabled.
  43. If an error occurs while writing the properties to a file, and this
  44. attribute is enabled, then a BuildException will be thrown, causing the
  45. build to fail. If disabled, then IO errors will be reported as a log
  46. statement, and the build will continue without failure from this task.</td>
  47. <td valign="top" align="center">No</td>
  48. </tr>
  49. <tr>
  50. <td valign="top">format</td>
  51. <td valign="top">One of <code>text</code> or <code>xml</code>.
  52. Determines the output format. Defaults to <code>text</code>.</td>
  53. <td valign="top" align="center">No</td>
  54. </tr>
  55. </table>
  56. <h3>Parameters specified as nested elements</h3>
  57. <h4>propertyset</h4>
  58. <p>You can specify subsets of properties to be echoed with <a
  59. href="../CoreTypes/propertyset.html">propertyset</a>s.</p>
  60. <p><em>since Ant 1.6</em>.</p>
  61. <h3>Examples</h3>
  62. <blockquote><pre>
  63. &lt;echoproperties/&gt;
  64. </pre></blockquote>
  65. <p>Report the current properties to the log.</p>
  66. <blockquote><pre>
  67. &lt;echoproperties destfile="my.properties"/&gt;
  68. </pre></blockquote>
  69. <p>Report the current properties to the file "my.properties", and will
  70. fail the build if the file could not be created or written to.</p>
  71. <blockquote><pre>
  72. &lt;echoproperties destfile="my.properties" failonerror="false"/&gt;
  73. </pre></blockquote>
  74. <p>Report the current properties to the file "my.properties", and will
  75. log a message if the file could not be created or written to, but will still
  76. allow the build to continue.</p>
  77. <blockquote><pre>
  78. &lt;echoproperties prefix="java."/&gt;
  79. </pre></blockquote>
  80. <p>List all properties beginning with "java."</p>
  81. <blockquote><pre>
  82. &lt;echoproperties&gt;
  83. &lt;propertyset&gt;
  84. &lt;propertyref prefix="java."/&gt;
  85. &lt;/propertyset&gt;
  86. &lt;/echoproperties&gt;
  87. </pre></blockquote>
  88. <p>List all properties beginning with "java."</p>
  89. <hr>
  90. <p align="center">Copyright &copy; 2002-2005 The Apache Software Foundation. All rights
  91. Reserved.</p>
  92. </body>
  93. </html>