task downloadFile(type: Download) { src 'https://example.com' dest layout.buildDirectory.file('downloads/tool.zip') overwrite false // Only download if the file doesn't exist } Use code with caution. Advanced Configuration Options
Setting tempAndMove true downloads the file to a temporary location first, moving it to the final destination only after a successful completion. This prevents corrupted, partially-downloaded files. Practical Workflows Downloading and Unzipping download task gradle
Use retries to specify how many times the task should attempt to re-download a file if the connection fails. task downloadFile(type: Download) { src 'https://example
Supports Basic authentication. If the server requires it, use username and password . You can also enable preemptiveAuth if the server doesn't send a standard challenge. download task gradle
The plugin offers several properties to handle more complex scenarios: