jarlib-resolve
Description
Try to locate a jar to satisfy an extension and place location of jar into property. The task allows you to add a number of resolvers that are capable of locating a library for a specific extension. Each resolver will be attempted in specified order until library is found or no resolvers are left. If no resolvers are left and failOnError is true then a BuildException will be thrown.
Note that this task works with extensions as defined by the "Optional Package" specification. For more information about optional packages, see the document Optional Package Versioning in the documentation bundle for your Java2 Standard Edition package, in file
guide/extensions/versioning.html
or the online Extension and ExtensionSet documentation for further detailsParameters
Attribute Description Required property The name of property to set to library location. Yes failOnError True if failure to locate library should result in build exception. No, defaults to true. checkExtension True if libraries returned by nested resolvers should be checked to see if they supply extension. No, defaults to true. Parameters specified as nested elements
extension
Extension the extension to resolve. Must be present
location
The location sub element allows you to look for a library in a location relative to project directory.
Attribute Description Required location The pathname of library. Yes url
The url resolver allows you to download a library from a URL to a local file.
Attribute Description Required url The URL to download. Yes destfile The file to download URL into. No, But one of destfile or destdir must be present destdir The directory in which to place downloaded file. No, But one of destfile or destdir must be present ant
The ant resolver allows you to run an Apache Ant build file to generate a library.
Attribute Description Required antfile The build file. Yes destfile The file that the ant build creates. Yes target The target to run in build file. No Examples
Resolve Extension to file. If file does not exist or file does not implement extension then throw an exception.
<extension id="dve.ext" extensionName="org.realityforge.dve" specificationVersion="1.2" specificationVendor="Peter Donald"/> <jarlib-resolve property="dve.library"> <extension refid="dve.ext"/> <location location="/opt/jars/dve.jar"/> </jarlib-resolve>Resolve Extension to url. If url does not exist or can not write to destfile or files does not implement extension then throw an exception.
<extension id="dve.ext" extensionName="org.realityforge.dve" specificationVersion="1.2" specificationVendor="Peter Donald"/> <jarlib-resolve property="dve.library"> <extension refid="dve.ext"/> <url url="http://www.realityforge.net/jars/dve.jar" destfile="lib/dve.jar"/> </jarlib-resolve>Resolve Extension to file produce by ant build. If file does not get produced or ant file is missing or build fails then throw an exception (Note does not check that library implements extension).
<extension id="dve.ext" extensionName="org.realityforge.dve" specificationVersion="1.2" specificationVendor="Peter Donald"/> <jarlib-resolve property="dve.library" checkExtension="false"> <extension refid="dve.ext"/> <ant antfile="../dve/build.xml" target="main" destfile="lib/dve.jar"/> </jarlib-resolve>Resolve Extension via multiple methods. First check local file to see if it implements extension. If it does not then try to build it from source in parallel directory. If that fails then finally try to download it from a website. If all steps fail then throw a build exception.
<extension id="dve.ext" extensionName="org.realityforge.dve" specificationVersion="1.2" specificationVendor="Peter Donald"/> <jarlib-resolve property="dve.library"> <extension refid="dve.ext"/> <location location="/opt/jars/dve.jar"/> <ant antfile="../dve/build.xml" target="main" destfile="lib/dve.jar"/> <url url="http://www.realityforge.net/jars/dve.jar" destfile="lib/dve.jar"/> </jarlib-resolve>