java left logo
java middle logo
java right logo
 

Home arrow Other API Tips arrow Ant arrow How to use Jarlib-resolve task
 
 
Main Menu
Home
Java Tutorials
Book Reviews
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Java Network
Java Forums
Java Blog




Most Visited Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews
Top Rated Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews


Statistics
Registered Users: 4093
Java SE Tips: 614
Java ME Tips: 202
Java EE Tips: 183
Other API Tips: 779
Java Applications: 298
Java Libraries: 209
Java Games: 16
Book Reviews:
 
 
 
How to use Jarlib-resolve task E-mail
User Rating: / 3
PoorBest 

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 online at http://java.sun.com/j2se/1.3/docs/guide/extensions/versioning.html.

See the Extension and ExtensionSet documentation for further details

Parameters

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 a 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>

Source: Apache Ant


 Related Tips

 
< Prev   Next >

Page 1 of 0 ( 0 comments )

You can share your information about this topic using the form below!

Please do not post your questions with this form! Thanks.


Name (required)


E-Mail (required)

Your email will not be displayed on the site - only to our administrator
Homepage(optional)



Comment Enable HTML code : Yes No



 
       
         
     
 
 
 
   
 
 
java bottom left
java bottom middle
java bottom right
RSS 0.91 FeedRSS 1.0 FeedRSS 2.0 FeedATOM FeedOPML Feed

Home - About Us - Privacy Policy
Copyright 2005 - 2008 www.java-tips.org
Java is a trademark of Sun Microsystems, Inc.