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.

conditions.html 20 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  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>Conditions Task</title>
  6. </head>
  7. <body>
  8. <h2><a name="Conditions">Conditions</a></h2>
  9. <p>Conditions are nested elements of the
  10. <a href="condition.html"><code>&lt;condition&gt;</code></a> and
  11. <a href="waitfor.html"><code>&lt;waitfor&gt;</code></a> tasks.
  12. There are core conditions and custom conditions. Custom
  13. conditions are described in
  14. <a href="../CoreTypes/custom-programming.html#customconditions">
  15. Custom Conditions</a>.
  16. Core Conditions are described below.
  17. </p>
  18. <h3><a name="coreconditions">Core Conditions</a></h3>
  19. <p>These are the nested elements that can be used as conditions in the
  20. <a href="condition.html"><code>&lt;condition&gt;</code></a> and
  21. <a href="waitfor.html"><code>&lt;waitfor&gt;</code></a> tasks.</p>
  22. <h4>not</h4>
  23. <p>The <code>&lt;not&gt;</code> element expects exactly one other
  24. condition to be nested into this element, negating the result of the
  25. condition. It doesn't have any attributes and accepts all nested
  26. elements of the condition task as nested elements as well.</p>
  27. <h4>and</h4> <p>
  28. The <code>&lt;and&gt;</code> element doesn't have any attributes and
  29. accepts an arbitrary number of conditions as nested elements - all
  30. nested elements of the condition task are supported. This condition
  31. is true if all of its contained conditions are, conditions will be
  32. evaluated in the order they have been specified in the build file.</p>
  33. <p>The <code>&lt;and&gt;</code> condition has the same shortcut
  34. semantics as the Java &amp;&amp; operator, as soon as one of the
  35. nested conditions is false, no other condition will be evaluated.</p>
  36. <h4>or</h4> <p>
  37. The <code>&lt;or&gt;</code> element doesn't have any attributes and
  38. accepts an arbitrary number of conditions as nested elements - all
  39. nested elements of the condition task are supported. This condition
  40. is true if at least one of its contained conditions is, conditions
  41. will be evaluated in the order they have been specified in the build
  42. file.</p> <p>The <code>&lt;or&gt;</code> condition has the same
  43. shortcut semantics as the Java || operator, as soon as one of the
  44. nested conditions is true, no other condition will be evaluated.</p>
  45. <h4>xor</h4>
  46. <p>The <code>&lt;xor&gt;</code> element performs an exclusive
  47. or on all nested elements, similar to the <code>^</code> operator
  48. in Java. It only evaluates to true if an odd number of nested conditions
  49. are true. There is no shortcutting of evaluation, unlike the <code>&lt;and&gt;</code>
  50. and <code>&lt;or&gt;</code> tests.
  51. It doesn't have any attributes and accepts all nested
  52. elements of the condition task as nested elements as well.</p>
  53. <h4>available</h4>
  54. <p>This condition is identical to the <a
  55. href="available.html">Available</a> task, all attributes and nested
  56. elements of that task are supported, the property and value attributes
  57. are redundant and will be ignored.</p>
  58. <h4>uptodate</h4>
  59. <p>This condition is identical to the <a
  60. href="uptodate.html">Uptodate</a> task, all attributes and nested
  61. elements of that task are supported, the property and value attributes
  62. are redundant and will be ignored.</p>
  63. <h4>os</h4>
  64. <p>Test whether the current operating system is of a given type. Each
  65. defined attribute is tested and the result is true only if <i>all</i>
  66. the tests succeed.
  67. </p>
  68. <table border="1" cellpadding="2" cellspacing="0">
  69. <tr>
  70. <td valign="top"><b>Attribute</b></td>
  71. <td valign="top"><b>Description</b></td>
  72. <td align="center" valign="top"><b>Required</b></td>
  73. </tr>
  74. <tr>
  75. <td valign="top">family</td>
  76. <td valign="top">The name of the operating system family to expect.</td>
  77. <td valign="top" align="center">No</td>
  78. </tr>
  79. <tr>
  80. <td valign="top">name</td>
  81. <td valign="top">The name of the operating system to expect.</td>
  82. <td valign="top" align="center">No</td>
  83. </tr>
  84. <tr>
  85. <td valign="top">arch</td>
  86. <td valign="top">The architecture of the operating system to expect.</td>
  87. <td valign="top" align="center">No</td>
  88. </tr>
  89. <tr>
  90. <td valign="top">version</td>
  91. <td valign="top">The version of the operating system to expect.</td>
  92. <td valign="top" align="center">No</td>
  93. </tr>
  94. </table>
  95. <p>Supported values for the family attribute are:
  96. <ul>
  97. <li>windows (for all versions of Microsoft Windows)</li>
  98. <li>dos (for all Microsoft DOS based operating systems including
  99. Microsoft Windows and OS/2)</li>
  100. <li>mac (for all Apple Macintosh systems)</li>
  101. <li>unix (for all Unix and Unix-like operating systems)</li>
  102. <li>netware (for Novell NetWare)</li>
  103. <li>os/2 (for OS/2)</li>
  104. <li>tandem (for HP's NonStop Kernel - formerly Tandem)</li>
  105. <li>win9x for Microsoft Windows 95 and 98</li>
  106. <li>z/os for z/OS and OS/390</li>
  107. <li>os/400 for OS/400</li>
  108. <li>openvms for OpenVMS</li>
  109. </ul>
  110. <h4>equals</h4>
  111. <p>Tests whether the two given Strings are identical</p>
  112. <table border="1" cellpadding="2" cellspacing="0">
  113. <tr>
  114. <td valign="top"><b>Attribute</b></td>
  115. <td valign="top"><b>Description</b></td>
  116. <td align="center" valign="top"><b>Required</b></td>
  117. </tr>
  118. <tr>
  119. <td valign="top">arg1</td>
  120. <td valign="top">First string to test.</td>
  121. <td valign="top" align="center">Yes</td>
  122. </tr>
  123. <tr>
  124. <td valign="top">arg2</td>
  125. <td valign="top">Second string to test.</td>
  126. <td valign="top" align="center">Yes</td>
  127. </tr>
  128. <tr>
  129. <td valign="top">casesensitive</td>
  130. <td valign="top">Perform a case sensitive comparision. Default is
  131. true.</td>
  132. <td valign="top" align="center">No</td>
  133. </tr>
  134. <tr>
  135. <td valign="top">trim</td>
  136. <td valign="top">Trim whitespace from arguments before comparing
  137. them. Default is false.</td>
  138. <td valign="top" align="center">No</td>
  139. </tr>
  140. </table>
  141. <h4>isset</h4>
  142. <p>Test whether a given property has been set in this project.</p>
  143. <table border="1" cellpadding="2" cellspacing="0">
  144. <tr>
  145. <td valign="top"><b>Attribute</b></td>
  146. <td valign="top"><b>Description</b></td>
  147. <td align="center" valign="top"><b>Required</b></td>
  148. </tr>
  149. <tr>
  150. <td valign="top">property</td>
  151. <td valign="top">The name of the property to test.</td>
  152. <td valign="top" align="center">Yes</td>
  153. </tr>
  154. </table>
  155. <h4>checksum</h4>
  156. <p>This condition is identical to the <a href="checksum.html">Checksum</a>
  157. task, all attributes and nested elements of that task are supported,
  158. the property and overwrite attributes are redundant and will be
  159. ignored.</p>
  160. <h4>http</h4>
  161. <p>The <code>http</code> condition checks for a valid response from a
  162. web server of the specified url. By default, HTTP responses errors
  163. of 400 or greater are viewed as invalid.</p>
  164. <table border="1" cellpadding="2" cellspacing="0">
  165. <tr>
  166. <td width="12%" valign="top"><b>Attribute</b></td>
  167. <td width="78%" valign="top"><b>Description</b></td>
  168. <td width="10%" valign="top"><b>Required</b></td>
  169. </tr>
  170. <tr>
  171. <td valign="top">url</td>
  172. <td valign="top">The full URL of the page to request. The web server must
  173. return a status code below the value of <tt>errorsBeginAt</tt></td>
  174. <td align="center">Yes.</td>
  175. </tr>
  176. <tr>
  177. <td valign="top">errorsBeginAt</td>
  178. <td valign="top">The lowest HTTP response code that signals an error;
  179. by default '400'; server errors, not-authorized, not-found and the like
  180. are detected</td>
  181. <td align="center">No</td>
  182. </tr>
  183. </table>
  184. <h4>socket</h4>
  185. <p>The <code>socket</code> condition checks for the existence of a
  186. TCP/IP listener at the specified host and port.</p>
  187. <table border="1" cellpadding="2" cellspacing="0">
  188. <tr>
  189. <td width="12%" valign="top"><b>Attribute</b></td>
  190. <td width="78%" valign="top"><b>Description</b></td>
  191. <td width="10%" valign="top"><b>Required</b></td>
  192. </tr>
  193. <tr>
  194. <td valign="top">server</td>
  195. <td valign="top">The DNS name or IP address of the server.</td>
  196. <td align="center">Yes.</td>
  197. </tr>
  198. <tr>
  199. <td valign="top">port</td>
  200. <td valign="top">The port number to connect to.</td>
  201. <td align="center">Yes.</td>
  202. </tr>
  203. </table>
  204. <h4>filesmatch</h4>
  205. <p>Test two files for matching. Nonexistence of either file results in "false".
  206. This test does a byte for byte comparision, so test time scales with
  207. byte size. NB: if the files are different sizes , one of them is missing
  208. or the filenames match the answer is so obvious the detailed test is omitted.
  209. </p>
  210. <table border="1" cellpadding="2" cellspacing="0">
  211. <tr>
  212. <td width="12%" valign="top"><b>Attribute</b></td>
  213. <td width="78%" valign="top"><b>Description</b></td>
  214. <td width="10%" valign="top"><b>Required</b></td>
  215. </tr>
  216. <tr>
  217. <td valign="top">file1</td>
  218. <td valign="top">First file to test</td>
  219. <td align="center">Yes.</td>
  220. </tr>
  221. <tr>
  222. <td valign="top">file2</td>
  223. <td valign="top">Second file to test</td>
  224. <td align="center">Yes.</td>
  225. </tr>
  226. </table>
  227. <h4>contains</h4>
  228. <p>Tests whether a string contains another one.</p>
  229. <table border="1" cellpadding="2" cellspacing="0">
  230. <tr>
  231. <td valign="top"><b>Attribute</b></td>
  232. <td valign="top"><b>Description</b></td>
  233. <td align="center" valign="top"><b>Required</b></td>
  234. </tr>
  235. <tr>
  236. <td valign="top">string</td>
  237. <td valign="top">The string to search in.</td>
  238. <td valign="top" align="center">Yes</td>
  239. </tr>
  240. <tr>
  241. <td valign="top">substring</td>
  242. <td valign="top">The string to search for.</td>
  243. <td valign="top" align="center">Yes</td>
  244. </tr>
  245. <tr>
  246. <td valign="top">casesensitive</td>
  247. <td valign="top">Perform a case sensitive comparision. Default is
  248. true.</td>
  249. <td valign="top" align="center">No</td>
  250. </tr>
  251. </table>
  252. <h4>istrue</h4>
  253. <p>Tests whether a string equals any of the ant definitions of true,
  254. that is "true","yes", or "on"</p>
  255. <table border="1" cellpadding="2" cellspacing="0">
  256. <tr>
  257. <td valign="top"><b>Attribute</b></td>
  258. <td valign="top"><b>Description</b></td>
  259. <td align="center" valign="top"><b>Required</b></td>
  260. </tr>
  261. <tr>
  262. <td valign="top">value</td>
  263. <td valign="top">value to test</td>
  264. <td valign="top" align="center">Yes</td>
  265. </tr>
  266. </table>
  267. <pre>
  268. &lt;istrue value=&quot;${someproperty}&quot;/&gt;
  269. &lt;istrue value=&quot;false&quot;/&gt;
  270. </pre>
  271. <h4>isfalse</h4>
  272. <p>Tests whether a string is not true, the negation of &lt;istrue&gt;
  273. </p>
  274. <table border="1" cellpadding="2" cellspacing="0">
  275. <tr>
  276. <td valign="top"><b>Attribute</b></td>
  277. <td valign="top"><b>Description</b></td>
  278. <td align="center" valign="top"><b>Required</b></td>
  279. </tr>
  280. <tr>
  281. <td valign="top">value</td>
  282. <td valign="top">value to test</td>
  283. <td valign="top" align="center">Yes</td>
  284. </tr>
  285. </table>
  286. <pre>
  287. &lt;isfalse value=&quot;${someproperty}&quot;/&gt;
  288. &lt;isfalse value=&quot;false&quot;/&gt;
  289. </pre>
  290. <h4>isreference</h4>
  291. <p>Test whether a given reference has been defined in this project and
  292. - optionally - is of an expected type.</p>
  293. <p>This condition has been added in Apache Ant 1.6.</p>
  294. <table border="1" cellpadding="2" cellspacing="0">
  295. <tr>
  296. <td valign="top"><b>Attribute</b></td>
  297. <td valign="top"><b>Description</b></td>
  298. <td align="center" valign="top"><b>Required</b></td>
  299. </tr>
  300. <tr>
  301. <td valign="top">refid</td>
  302. <td valign="top">The id of the reference to test.</td>
  303. <td valign="top" align="center">Yes</td>
  304. </tr>
  305. <tr>
  306. <td valign="top">type</td>
  307. <td valign="top">Name of the data type or task this reference is
  308. expected to be.</td>
  309. <td valign="top" align="center">No</td>
  310. </tr>
  311. </table>
  312. <h4>issigned</h4>
  313. <p>
  314. Test whether a jarfile is signed.
  315. If the name of the
  316. signature is passed, the file is checked for presence of that
  317. particular signature; otherwise the file is checked for the
  318. existence of any signature. It does not perform rigorous
  319. signature validation; it only looks for the presence of a signature.
  320. </p>
  321. <p>
  322. This condition was added in Apache Ant 1.7.
  323. </p>
  324. <table border="1" cellpadding="2" cellspacing="0">
  325. <tr>
  326. <td valign="top"><b>Attribute</b></td>
  327. <td valign="top"><b>Description</b></td>
  328. <td align="center" valign="top"><b>Required</b></td>
  329. </tr>
  330. <tr>
  331. <td valign="top">file</td>
  332. <td valign="top">
  333. The jarfile that is to be tested for the presence
  334. of a signature.
  335. </td>
  336. <td valign="top" align="center">Yes</td>
  337. </tr>
  338. <tr>
  339. <td valign="top">name</td>
  340. <td valign="top"> The signature name to check for.</td>
  341. <td valign="top" align="center">No</td>
  342. </tr>
  343. </table>
  344. <h4>isfileselected</h4>
  345. <p>
  346. Test whether a file passes an embedded
  347. <a href="../CoreTypes/selectors.html">selector</a>.
  348. </p>
  349. <p>
  350. This condition was added in Apache Ant 1.6.3.
  351. </p>
  352. <table border="1" cellpadding="2" cellspacing="0">
  353. <tr>
  354. <td valign="top"><b>Attribute</b></td>
  355. <td valign="top"><b>Description</b></td>
  356. <td align="center" valign="top"><b>Required</b></td>
  357. </tr>
  358. <tr>
  359. <td valign="top">file</td>
  360. <td valign="top">
  361. The file to check if is passes the embedded selector.
  362. </td>
  363. <td valign="top" align="center">Yes</td>
  364. </tr>
  365. <tr>
  366. <td valign="top">basedir</td>
  367. <td valign="top">The base directory to use for name based selectors. It this is not set,
  368. the project's basedirectory will be used.</td>
  369. <td valign="top" align="center">No</td>
  370. </tr>
  371. </table>
  372. <p>
  373. Example usage:
  374. </p>
  375. <blockquote>
  376. <pre>
  377. &lt;isfileselected file="a.xml"&gt;
  378. &lt;date datetime="06/28/2000 2:02 pm" when="equal"/&gt;
  379. &lt;/isfileselected&gt;
  380. </pre></blockquote>
  381. <h4>typefound</h4>
  382. <p>Test whether a given type is defined, and that
  383. its implementation class can be loaded. Types include
  384. tasks, datatypes, scriptdefs, macrodefs and presetdefs.</p>
  385. <p>This condition was added in Apache Ant 1.7.</p>
  386. <table border="1" cellpadding="2" cellspacing="0">
  387. <tr>
  388. <td valign="top"><b>Attribute</b></td>
  389. <td valign="top"><b>Description</b></td>
  390. <td align="center" valign="top"><b>Required</b></td>
  391. </tr>
  392. <tr>
  393. <td valign="top">name</td>
  394. <td valign="top">name of the type</td>
  395. <td valign="top" align="center">Yes</td>
  396. </tr>
  397. </table>
  398. <h4>scriptcondition</h4>
  399. <p>Evaluate a condition based on a script in any
  400. <a href="http://jakarta.apache.org/bsf" target="_top">Apache BSF</a>
  401. supported language.</p>
  402. <p>
  403. See the <a href="../OptionalTasks/script.html">Script</a> task for
  404. an explanation of scripts and dependencies.
  405. </p>
  406. <p>This condition was added in Apache Ant 1.7.</p>
  407. <table border="1" cellpadding="2" cellspacing="0">
  408. <tr>
  409. <td valign="top"><b>Attribute</b></td>
  410. <td valign="top"><b>Description</b></td>
  411. <td align="center" valign="top"><b>Required</b></td>
  412. </tr>
  413. <tr>
  414. <td valign="top">language</td>
  415. <td valign="top">script language</td>
  416. <td valign="top" align="center">Yes</td>
  417. </tr>
  418. <tr>
  419. <td valign="top">value</td>
  420. <td valign="top">default boolean value</td>
  421. <td valign="top" align="center">No -default is "false"</td>
  422. </tr>
  423. <tr>
  424. <td valign="top">src</td>
  425. <td valign="top">filename of script source</td>
  426. <td valign="top" align="center">No</td>
  427. </tr>
  428. </table>
  429. <p>
  430. The script supports script language inline, this script has access to the
  431. same beans as the <code>&lt;script&gt;</code> task, and to the <code>
  432. self</code> bean, which refers back to the condition itself. The
  433. <code>value</code> property of this bean sets the return value:
  434. </p>
  435. <p>
  436. Example:
  437. </p>
  438. <pre>
  439. &lt;scriptcondition language=&quot;javascript&quot;
  440. value=&quot;true&quot;&gt;
  441. self.setValue(false);
  442. &lt;/scriptcondition&gt;
  443. </pre>
  444. Sets the default value of the condition to true, then in the script,
  445. sets the value to false. This condition always evaluates to "false"
  446. <h4>parsersupports</h4>
  447. <p>Tests whether Ant's XML parser supports a given
  448. feature or property, as per the SAX/JAXP specifications, by
  449. attempting to set the appropriate property/feature/</p>
  450. <p>This condition was added in Apache Ant 1.7.</p>
  451. <table border="1" cellpadding="2" cellspacing="0">
  452. <tr>
  453. <td valign="top"><b>Attribute</b></td>
  454. <td valign="top"><b>Description</b></td>
  455. <td align="center" valign="top"><b>Required</b></td>
  456. </tr>
  457. <tr>
  458. <td valign="top">property</td>
  459. <td valign="top">property to set</td>
  460. <td valign="top" align="center">one of property or feature</td>
  461. </tr>
  462. <tr>
  463. <td valign="top">feature</td>
  464. <td valign="top">feature to set</td>
  465. <td valign="top" align="center">one of property or feature</td>
  466. </tr>
  467. <tr>
  468. <td valign="top">value</td>
  469. <td valign="top">string (property) or boolean (feature)</td>
  470. <td valign="top" align="center">For property tests, but not for feature tests</td>
  471. </tr>
  472. </table>
  473. <pre>
  474. &lt;parsersupports feature="http://xml.org/sax/features/namespaces"/&gt;
  475. </pre>
  476. Check for namespace support. All SAX2 parsers should have this.
  477. <pre>
  478. &lt;or&gt;
  479. &lt;parsersupports
  480. feature="http://apache.org/xml/features/validation/schema"/&gt;
  481. &lt;parsersupports
  482. feature="http://java.sun.com/xml/jaxp/properties/schemaSource"/&gt;
  483. &lt;/or&gt;
  484. </pre>
  485. Check for XML Schema support.
  486. <pre>
  487. &lt;parsersupports
  488. property="http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation"
  489. value="document.xsd"/&gt;
  490. </pre>
  491. Check for Xerces-specific definition of the location of the no namespace schema.
  492. <h4>isreachable</h4>
  493. <p>Uses Java1.5+ networking APIs to probe for a (remote) system being
  494. reachable. Exactly what probe mechanisms are used is an implementation
  495. feature of the JVM. They may include ICMP "ping" packets, UDP or TCP connections
  496. to port 7 "echo service" or other means. On Java1.4 and earlier, being able
  497. to resolve the hostname is considered success. This means that if DNS is not
  498. working or a URL/hostname is bad, the test will fail, but otherwise succeed
  499. even if the remote host is actually absent.
  500. </p>
  501. <p>
  502. This condition turns unknown host exceptions into false conditions. This is
  503. because on a laptop, DNS is one of the first services when the network goes; you
  504. are implicitly offline.
  505. </p>
  506. <p>
  507. If a URL is supplied instead of a host, the hostname is extracted
  508. and used in the test - all other parts of the URL are discarded.
  509. </p>
  510. <p>
  511. The test may not work through firewalls, that is, something may be reachable
  512. using a protocol such as HTTP, while the lower level ICMP packets get dropped
  513. on the floor. Similarly, a host may detected as reachable with ICMP, but
  514. not reachable on other ports (i.e. port 80), because of firewalls.
  515. </p>
  516. <p>
  517. This condition was added in Apache Ant 1.7.</p>
  518. <table border="1" cellpadding="2" cellspacing="0">
  519. <tr>
  520. <td valign="top"><b>Attribute</b></td>
  521. <td valign="top"><b>Description</b></td>
  522. <td align="center" valign="top"><b>Required</b></td>
  523. </tr>
  524. <tr>
  525. <td valign="top">host</td>
  526. <td valign="top">host to check for</td>
  527. <td valign="top" align="center">one of url or host</td>
  528. </tr>
  529. <tr>
  530. <td valign="top">url</td>
  531. <td valign="top">URL containing hostname</td>
  532. <td valign="top" align="center">one of url or host</td>
  533. </tr>
  534. <tr>
  535. <td valign="top">timeout</td>
  536. <td valign="top">timeout in seconds</td>
  537. <td valign="top" align="center">no, default is 30s</td>
  538. </tr>
  539. </table>
  540. <pre>
  541. &lt;condition property="offline"&gt;
  542. &lt;isreachable url="http://ibiblio.org/maven/" /&gt;
  543. &lt;/condition&gt;
  544. </pre>
  545. <p>
  546. Probe for the maven repository being reachable.
  547. </p>
  548. <pre>
  549. &lt;condition property="offline"&gt;
  550. &lt;isreachable host="ibiblio.org" timeout="10" /&gt;
  551. &lt;/condition&gt;
  552. </pre>
  553. <p>
  554. Probe for the maven repository being reachable using the hostname, ten second timeout..
  555. </p>
  556. <h4>length</h4>
  557. <p>This condition is a facet of the <a href="length.html">Length</a> task.
  558. It is used to test the length of a string or one or more files.
  559. <b>Since Ant 1.6.3</b>
  560. </p>
  561. Verify a string is of a certain length:
  562. <pre>
  563. &lt;length string=&quot; foo &quot; trim="true" length=&quot;3&quot;/&gt;
  564. </pre>
  565. Verify a file is not empty:
  566. <pre>
  567. &lt;length file=&quot;foo&quot; when=&quot;greater&quot; length=&quot;0&quot;/&gt;
  568. </pre>
  569. <hr>
  570. <p align="center">Copyright &copy; 2001-2005 Apache Software
  571. Foundation. All rights Reserved.</p>
  572. </body>
  573. </html>