java left logo
java middle logo
java right logo

Home arrow Other API Tips
Main Menu
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

Registered Users: 4116
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 Get task E-mail
User Rating: / 5



Gets a file from a URL. When the verbose option is "on", this task displays a '.' for every 100 Kb retrieved. Any URL schema supported by the runtime is valid here, including http:, ftp: and jar:; https: is only valid if the appropriate support is added to the pre-1.4 Java runtimes.

This task should be preferred above the CVS task when fetching remote content. CVS is significantly slower than loading a compressed archive compared to http/ftp.

The usetimestamp option enables you to control downloads so that the remote file is only fetched if newer than the local copy. If there is no local copy, the download always takes place. When a file is downloaded, the timestamp of the downloaded file is set to the remote timestamp, if the JVM is Java1.2 or later. NB: This timestamp facility only works on downloads using the HTTP protocol.

A username and password can be specified, in which case basic 'slightly encoded plain text' authentication is used. This is only a secure authentication mechanism over an HTTPS link.

If you need to go through a firewall, use <setproxy> to set up the proxy first.


Attribute Description Required
src the URL from which to retrieve a file. Yes
dest the file where to store the retrieved file. Yes
verbose show verbose progress information ("on"/"off"). No; default "false"
ignoreerrors Log errors but don't treat as fatal. No; default "false"
usetimestamp conditionally download a file based on the timestamp of the local copy. HTTP only No; default "false"
username username for 'BASIC' http authentication if password is set
password password: required if username is set


  <get src="" dest="help/index.html"/>

Gets the index page of, and stores it in the file help/index.html.

  <get src="" 

Gets the PGP keys of Ant's (current and past) release managers, if the local copy is missing or out of date. Uses the verbose option for progress information.

  <get src="" 

Fetches some file from a server with access control. Because https is being used the fact that basic auth sends passwords in plaintext is moot.

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

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
Java is a trademark of Sun Microsystems, Inc.