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.

jarlib-resolve.html 7.6 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <!--
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. -->
  15. <html>
  16. <head>
  17. <meta http-equiv="Content-Language" content="en-us">
  18. <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
  19. <title>jarlib-resolve Task</title>
  20. </head>
  21. <body>
  22. <h2><a name="jarlib-resolve">jarlib-resolve</a></h2>
  23. <h3>Description</h3>
  24. <p>Try to locate a jar to satisfy an extension and place
  25. location of jar into property. The task allows you to
  26. add a number of resolvers that are capable of locating a
  27. library for a specific extension. Each resolver will be attempted
  28. in specified order until library is found or no resolvers are left.
  29. If no resolvers are left and failOnError is true then a BuildException
  30. will be thrown.</p>
  31. <p>Note that this task
  32. works with extensions as defined by the "Optional Package" specification.
  33. For more information about optional packages, see the document
  34. <em>Optional Package Versioning</em> in the documentation bundle for your
  35. Java2 Standard Edition package, in file
  36. <code>guide/extensions/versioning.html</code> or online at
  37. <a href="http://java.sun.com/j2se/1.3/docs/guide/extensions/versioning.html">
  38. http://java.sun.com/j2se/1.3/docs/guide/extensions/versioning.html</a>.</p>
  39. <p>See the Extension and ExtensionSet documentation for further details</p>
  40. <h3>Parameters</h3>
  41. <table border="1" cellpadding="2" cellspacing="0">
  42. <tr>
  43. <td valign="top"><b>Attribute</b></td>
  44. <td valign="top"><b>Description</b></td>
  45. <td align="center" valign="top"><b>Required</b></td>
  46. </tr>
  47. <tr>
  48. <td valign="top">property</td>
  49. <td valign="top">The name of property to set to library location.</td>
  50. <td valign="top" align="center">Yes</td>
  51. </tr>
  52. <tr>
  53. <td valign="top">failOnError</td>
  54. <td valign="top">True if failure to locate library should result in build exception.</td>
  55. <td valign="top" align="center">No, defaults to true.</td>
  56. </tr>
  57. <tr>
  58. <td valign="top">checkExtension</td>
  59. <td valign="top">True if libraries returned by nested resolvers should be checked to see if
  60. they supply extension.</td>
  61. <td valign="top" align="center">No, defaults to true.</td>
  62. </tr>
  63. </table>
  64. <h3>Parameters specified as nested elements</h3>
  65. <h4>extension</h4>
  66. <p><a href="../OptionalTypes/extension.html">Extension</a> the extension
  67. to resolve. Must be present</p>
  68. <h4>location</h4>
  69. <p>The location sub element allows you to look for a library in a
  70. location relative to project directory.</p>
  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">location</td>
  79. <td valign="top">The pathname of library.</td>
  80. <td valign="top" align="center">Yes</td>
  81. </tr>
  82. </table>
  83. <h4>url</h4>
  84. <p>The url resolver allows you to download a library from a URL to a
  85. local file.</p>
  86. <table border="1" cellpadding="2" cellspacing="0">
  87. <tr>
  88. <td valign="top"><b>Attribute</b></td>
  89. <td valign="top"><b>Description</b></td>
  90. <td align="center" valign="top"><b>Required</b></td>
  91. </tr>
  92. <tr>
  93. <td valign="top">url</td>
  94. <td valign="top">The URL to download.</td>
  95. <td valign="top" align="center">Yes</td>
  96. </tr>
  97. <tr>
  98. <td valign="top">destfile</td>
  99. <td valign="top">The file to download URL into.</td>
  100. <td valign="top" align="center">No, But one of destfile or
  101. destdir must be present</td>
  102. </tr>
  103. <tr>
  104. <td valign="top">destdir</td>
  105. <td valign="top">The directory in which to place downloaded file.</td>
  106. <td valign="top" align="center">No, But one of destfile or
  107. destdir must be present</td>
  108. </tr>
  109. </table>
  110. <h4>ant</h4>
  111. <p>The ant resolver allows you to run a ant build file to generate a library.</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">antfile</td>
  120. <td valign="top">The build file.</td>
  121. <td valign="top" align="center">Yes</td>
  122. </tr>
  123. <tr>
  124. <td valign="top">destfile</td>
  125. <td valign="top">The file that the ant build creates.</td>
  126. <td valign="top" align="center">Yes</td>
  127. </tr>
  128. <tr>
  129. <td valign="top">target</td>
  130. <td valign="top">The target to run in build file.</td>
  131. <td valign="top" align="center">No</td>
  132. </tr>
  133. </table>
  134. <h3>Examples</h3>
  135. <p><b>Resolve Extension to file.</b> If file does not exist or file
  136. does not implement extension then throw an exception.</p>
  137. <pre>
  138. &lt;extension id=&quot;dve.ext&quot;
  139. extensionName=&quot;org.realityforge.dve&quot;
  140. specificationVersion=&quot;1.2&quot;
  141. specificationVendor=&quot;Peter Donald&quot;/&gt;
  142. &lt;jarlib-resolve property="dve.library"&gt;
  143. &lt;extension refid="dve.ext"/&gt;
  144. &lt;location location="/opt/jars/dve.jar"/&gt;
  145. &lt;/jarlib-resolve&gt;
  146. </pre>
  147. <p><b>Resolve Extension to url.</b> If url does not exist or can not write
  148. to destfile or files does not implement extension then throw an exception.</p>
  149. <pre>
  150. &lt;extension id=&quot;dve.ext&quot;
  151. extensionName=&quot;org.realityforge.dve&quot;
  152. specificationVersion=&quot;1.2&quot;
  153. specificationVendor=&quot;Peter Donald&quot;/&gt;
  154. &lt;jarlib-resolve property="dve.library"&gt;
  155. &lt;extension refid="dve.ext"/&gt;
  156. &lt;url url="http://www.realityforge.net/jars/dve.jar" destfile="lib/dve.jar"/&gt;
  157. &lt;/jarlib-resolve&gt;
  158. </pre>
  159. <p><b>Resolve Extension to file produce by ant build.</b> If file does not get produced
  160. or ant file is missing or build fails then throw an exception (Note does not check
  161. that library implements extension).</p>
  162. <pre>
  163. &lt;extension id=&quot;dve.ext&quot;
  164. extensionName=&quot;org.realityforge.dve&quot;
  165. specificationVersion=&quot;1.2&quot;
  166. specificationVendor=&quot;Peter Donald&quot;/&gt;
  167. &lt;jarlib-resolve property="dve.library" checkExtension="false"&gt;
  168. &lt;extension refid="dve.ext"/&gt;
  169. &lt;ant antfile="../dve/build.xml" target="main" destfile="lib/dve.jar"/&gt;
  170. &lt;/jarlib-resolve&gt;
  171. </pre>
  172. <p><b>Resolve Extension via multiple methods.</b> First check local file to see if it implements
  173. extension. If it does not then try to build it from source in parallel directory. If that
  174. fails then finally try to download it from a website. If all steps fail then throw a build
  175. exception.</p>
  176. <pre>
  177. &lt;extension id=&quot;dve.ext&quot;
  178. extensionName=&quot;org.realityforge.dve&quot;
  179. specificationVersion=&quot;1.2&quot;
  180. specificationVendor=&quot;Peter Donald&quot;/&gt;
  181. &lt;jarlib-resolve property="dve.library"&gt;
  182. &lt;extension refid="dve.ext"/&gt;
  183. &lt;location location="/opt/jars/dve.jar"/&gt;
  184. &lt;ant antfile="../dve/build.xml" target="main" destfile="lib/dve.jar"/&gt;
  185. &lt;url url="http://www.realityforge.net/jars/dve.jar" destfile="lib/dve.jar"/&gt;
  186. &lt;/jarlib-resolve&gt;
  187. </pre>
  188. </body>
  189. </html>