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