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.
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 secure over an HTTPS link.
Proxies. Since Ant1.7, Ant running on Java1.5 or later defaults to
using
the proxy settings of the operating system. There is also the
<setproxy> task for
earlier Java versions. With proxies turned on, <get>
requests against
localhost may not work as expected, if the request is relayed to the proxy.
The -noproxy
option can be used to turn this feature off.
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="http://ant.apache.org/" dest="help/index.html"/>
Gets the index page of http://ant.apache.org/, and stores it in the file help/index.html
.
<get src="http://www.apache.org/dist/ant/KEYS" dest="KEYS" verbose="true" usetimestamp="true"/>
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="https://insecure-bank.org/statement/user=1214" dest="statement.html" username="1214"; password="secret"/>
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.