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.

libraries.html 11 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>Libraries Task</title>
  5. </head>
  6. <body>
  7. <h2><a name="echo">Libraries</a></h2>
  8. <h3>Description</h3>
  9. <p>
  10. Extensible library download mechanism, integrated with the
  11. <a href="http://maven.apache.org/">Maven</a> repository hosted
  12. at ibiblio.org.
  13. </p>
  14. <p>
  15. This task can:
  16. </p>
  17. <ol>
  18. <li>Download publicly published JAR files by version.</li>
  19. <li>Download JAR files from private file: or http: repositories</li>
  20. <li>Cache the JAR files in a directory tree</li>
  21. <li>Check for updates on a regular schedule</li>
  22. <li>Build paths for compilation/execution.</li>
  23. <li>Fail the build if needed libraries are missing</li>
  24. <li>Force an update of all libraries</li>
  25. <li>Skip all downloading when offline
  26. </ol>
  27. <h3>Parameters</h3>
  28. <table border="1" cellpadding="2" cellspacing="0">
  29. <tr>
  30. <td valign="top"><b>Attribute</b></td>
  31. <td valign="top"><b>Description</b></td>
  32. <td align="center" valign="top"><b>Required</b></td>
  33. </tr>
  34. <tr>
  35. <td valign="top">destDir</td>
  36. <td valign="top">Destination directory for all downloads
  37. </td>
  38. <td valign="top" align="center">Yes</td>
  39. </tr>
  40. <tr>
  41. <td valign="top">offline</td>
  42. <td valign="top">Flag to indicate that the system is offline, and that
  43. no downloads should take place.
  44. </td>
  45. <td valign="top" align="center">No</td>
  46. </tr>
  47. <tr>
  48. <td valign="top">flatten</td>
  49. <td valign="top">flag to indicate that files should be flattened when downloaded
  50. </td>
  51. <td valign="top" align="center">No -default false</td>
  52. </tr>
  53. <tr>
  54. <td valign="top">pathID</td>
  55. <td valign="top">Name of a path to create containing all
  56. libraries in this declaration.
  57. </td>
  58. <td valign="top" align="center">No</td>
  59. </tr>
  60. <tr>
  61. <td valign="top">repositoryRef</td>
  62. <td valign="top">Reference to a predefined repository
  63. </td>
  64. <td valign="top" align="center">Only if no repository is defined inline</td>
  65. </tr>
  66. </table>
  67. </table>
  68. <h3>Nested Elements</h3>
  69. <h4>library</h4>
  70. This is the core of the system; a library to (potentially) download.
  71. <table border="1" cellpadding="2" cellspacing="0">
  72. <tr>
  73. <td valign="top"><b>Attribute</b></td>
  74. <td valign="top"><b>Description</b></td>
  75. <td align="center" valign="top"><b>Required</b></td>
  76. </tr>
  77. <tr>
  78. <td valign="top">project</td>
  79. <td valign="top">Name of the project
  80. </td>
  81. <td valign="top" align="center">Yes</td>
  82. </tr>
  83. <tr>
  84. <td valign="top">version</td>
  85. <td valign="top">
  86. </td>
  87. <td valign="top" align="center">Yes</td>
  88. </tr>
  89. <tr>
  90. <td valign="top">archive</td>
  91. <td valign="top">Name of the archive
  92. </td>
  93. <td valign="top" align="center">No</td>
  94. </tr>
  95. <tr>
  96. <td valign="top">destinationName</td>
  97. <td valign="top">Filename of downloaded file
  98. </td>
  99. <td valign="top" align="center">No, default remote name</td>
  100. </tr>
  101. <tr>
  102. <td valign="top">suffix</td>
  103. <td valign="top">Suffix of the archive
  104. </td>
  105. <td valign="top" align="center">No -default ".jar"</td>
  106. </tr>
  107. <tr>
  108. <td valign="top">enabled</td>
  109. <td valign="top">flag to turn on or off specific download/use
  110. of an archive
  111. </td>
  112. <td valign="top" align="center">No -default "true"</td>
  113. </tr>
  114. </table>
  115. <h4>Repository</h4>
  116. A repository is Ant datatype that extends the <code>Repository</code> type.
  117. Ant only ships with one: the mavenrepository;
  118. <table border="1" cellpadding="2" cellspacing="0">
  119. <tr>
  120. <td valign="top"><b>Attribute</b></td>
  121. <td valign="top"><b>Description</b></td>
  122. <td align="center" valign="top"><b>Required</b></td>
  123. </tr>
  124. <tr>
  125. <td valign="top">url</td>
  126. <td valign="top">URL of the repository
  127. </td>
  128. <td valign="top" align="center">No</td>
  129. </tr>
  130. <tr>
  131. <td valign="top"></td>
  132. <td valign="top">
  133. </td>
  134. <td valign="top" align="center">No</td>
  135. </tr>
  136. </table>
  137. <p>Example:</p>
  138. <pre>
  139. &lt;repository ref=&quot;predefined.repository&quot; /&gt;
  140. </pre>
  141. <h4>mavenrepository</h4>
  142. <table border="1" cellpadding="2" cellspacing="0">
  143. <tr>
  144. <td valign="top"><b>Attribute</b></td>
  145. <td valign="top"><b>Description</b></td>
  146. <td align="center" valign="top"><b>Required</b></td>
  147. </tr>
  148. <tr>
  149. <td valign="top">url</td>
  150. <td valign="top">URL of the repository
  151. </td>
  152. <td valign="top" align="center">No</td>
  153. </tr>
  154. <tr>
  155. <td valign="top">checkMD5</td>
  156. <td valign="top">Flag to turn on MD5 checking
  157. (unimplemented)
  158. </td>
  159. <td valign="top" align="center">No</td>
  160. </tr>
  161. <tr>
  162. <td valign="top">username</td>
  163. <td valign="top">HTTP authentication username
  164. </td>
  165. <td valign="top" align="center">No</td>
  166. </tr>
  167. <tr>
  168. <td valign="top">password</td>
  169. <td valign="top">HTTP authentication password
  170. </td>
  171. <td valign="top" align="center">Only if username is set</td>
  172. </tr>
  173. </table>
  174. <h3>UpdatePolicies</h3>
  175. <P>Update policies are an (extensible) means of tuning the download, running
  176. code before and possibly after a download. They can enable or disable
  177. checks for individual files, skip the download process, or perform some
  178. post-download validation.
  179. </P>
  180. <P>All policies have at least the common set of attributes; some may have more,
  181. in which case an updated attribute list is shown. </P>
  182. <table border="1" cellpadding="2" cellspacing="0">
  183. <tr>
  184. <td valign="top"><b>Attribute</b></td>
  185. <td valign="top"><b>Description</b></td>
  186. <td align="center" valign="top"><b>Required</b></td>
  187. </tr>
  188. <tr>
  189. <td valign="top">enabled</td>
  190. <td valign="top">Enabled flag
  191. </td>
  192. <td valign="top" align="center">No -default "true"</td>
  193. </tr>
  194. </table>
  195. <P>Policies can be chained by listing them in order. Before an update/download
  196. takes place, all policies will be executed in order. After the download, the
  197. policies will be invoked in reverse order. The compound policy in such a
  198. situation is left to the experimentor, though reading the source will help.
  199. </P>
  200. <p>
  201. Developers may add new polices (such
  202. as signing incoming files) by adding new datatypes extending the
  203. <code>LibraryPolicy</code> class. </P>
  204. <h4>noupdate</h4>
  205. <P>This policy will disable remote downloads when enabled. It is the policy
  206. equivalent of the offline flag.</P>
  207. <p>Example:</p>
  208. <pre>
  209. &lt;noupdate /&gt;
  210. </pre>
  211. <h4>forceupdate</h4>
  212. <P>This policy forces all libraries to be downloaded. If any download failed,
  213. the build will halt.</P>
  214. <p>Example:</p>
  215. <pre>
  216. &lt;forceupdate /&gt;
  217. </pre>
  218. <h4>timestamp</h4>
  219. <P>This policy tells Ant to check the repository to see if the files have changed
  220. using timestamp checks. Any files which are up to date will not be downloaded again. </P>
  221. <p>Example:</p>
  222. <pre>
  223. &lt;timestamp /&gt;
  224. </pre>
  225. <h4>scheduledupdate</h4>
  226. This policy tells Ant to check the repository to see if the files have changed,
  227. but only intermittently. An interval of the size of the schedule has to have
  228. passed, or the set of files to check has to have changed.
  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">enabled</td>
  237. <td valign="top">Enabled flag
  238. </td>
  239. <td valign="top" align="center">No -default "true"</td>
  240. </tr>
  241. <tr>
  242. <td valign="top">markerFile</td>
  243. <td valign="top">Name of a file to cache download history
  244. </td>
  245. <td valign="top" align="center">Yes</td>
  246. </tr>
  247. <tr>
  248. <td valign="top">Days</td>
  249. <td valign="top">number of days between update checks
  250. </td>
  251. <td valign="top" align="center">No</td>
  252. </tr>
  253. <tr>
  254. <td valign="top">Hours</td>
  255. <td valign="top">number of hours between update checks
  256. </td>
  257. <td valign="top" align="center">No</td>
  258. </tr>
  259. <tr>
  260. <td valign="top">Minutes</td>
  261. <td valign="top">number of minutes between update checks
  262. </td>
  263. <td valign="top" align="center">No</td>
  264. </tr>
  265. </table>
  266. <p>Example:</p>
  267. <pre>
  268. &lt;scheduledupdate days="1" hours="3" minutes="17" /&gt;
  269. </pre>
  270. <P>Check for an update every 27 hours, 17 minutes. </P>
  271. <h4>assertdownloaded</h4>
  272. <P>This policy is really for testing the library. It does not
  273. alter the download policy, but after any download has taken place,
  274. it verifies that the number of files downloaded matches the number
  275. expected.</P>
  276. <table border="1" cellpadding="2" cellspacing="0">
  277. <tr>
  278. <td valign="top"><b>Attribute</b></td>
  279. <td valign="top"><b>Description</b></td>
  280. <td align="center" valign="top"><b>Required</b></td>
  281. </tr>
  282. <tr>
  283. <td valign="top">count</td>
  284. <td valign="top">number of downloaded files expected.
  285. </td>
  286. <td valign="top" align="center">Yes</td>
  287. </tr>
  288. <tr>
  289. <td valign="top">enabled</td>
  290. <td valign="top">Enabled flag
  291. </td>
  292. <td valign="top" align="center">No -default "true"</td>
  293. </tr>
  294. </table>
  295. <p>Example:</p>
  296. <pre>
  297. &lt;assertdownloaded cound="4" /&gt;
  298. </pre>
  299. <h3>Examples</h3>
  300. <pre>
  301. &lt;!--
  302. versions.properties says
  303. xdoclet.version=2.0
  304. commons-logging.version=1.0.3
  305. commons-collections.version=3.1
  306. --&gt;
  307. &lt;property file="versions.properties" /&gt;
  308. &lt;libraries destDir="${lib.dir}" pathid="xdoclet.lib" &gt;
  309. &lt;mavenrepository /&gt;
  310. &lt;library project="xdoclet"
  311. version="${xdoclet.version}" /&gt;
  312. &lt;library project="commons-logging"
  313. version="${commons-logging.version}" /&gt;
  314. &lt;library project="commons-collections"
  315. version="${commons-collections.version}" /&gt;
  316. &lt;/libraries&gt;
  317. </pre>
  318. <P>Load in versions from a file, then download the relevant archives. No
  319. update schedule is defined, but a path is created for insertion into a
  320. classpath. This property file driven dependency model is what we recommend
  321. over hard coding versions in a build file.
  322. </P>
  323. <PRE> &lt;libraries destDir="build/lib" offline="${offline}" flatten="true"&gt;
  324. &lt;mavenrepository url="${private.server}"/&gt;
  325. &lt;library project="doomed" archive="dead-code"
  326. suffix=".war"
  327. destinationName="product.war"
  328. version="LATEST"
  329. /&gt;
  330. &lt;scheduledupdate markerfile="build/lib/marker.properties"
  331. hours="11" /&gt;
  332. &lt;/libraries&gt;
  333. </PRE>
  334. <P>Download doomed/dead-code.LATEST.war from a private repository, save it to
  335. build/lib/product.war with an update schedule of every eleven hours.
  336. </P>
  337. <p align="center">Copyright &copy; 2005 The Apache Software Foundation. All rights
  338. Reserved.</p>
  339. </body>
  340. </html>