New features in gradle-download-task 3.4.0

The new version 3.4.0 of gradle-download-task, a Gradle plugin providing a Download task that display progress information, has just been released. It contains many new features and updating is recommended for all users.

Grab gradle-download-task 3.4.0 while it’s still hot:

The new version has been tested with Gradle 1.x up to 4.6 but should be compatible to any other version as well.

New features

Here’s a short overview of all new features (more details below):

  • Add support for ETags
  • Add tempAndMove configuration flag
  • Register top-level properties Download and Verify for the tasks provided by the plugin
  • Add verifyChecksum extension as an alternative to the Verify task
  • Deprecate Java 6
  • Deprecate Gradle 1.x
  • Add integrations tests for all Gradle versions up to 4.6

Support for the HTTP ETag header

The plugin can now use the HTTP ETag header to check if a file has been changed on the server or not. You can enable this feature through the onlyIfModified flag and the new useETag flag. If both of them are true, the plugin will check a file’s timestamp as well as its entity tag (ETag) and only download it if it has been modified on the server since the last download. The plugin can differentiate between strong and weak ETags.

Possible values for the new useETag flag are:

false (default)

Do not use the ETag


Use the ETag but display a warning if it is weak


Use the ETag and do not display a warning if it is weak


Only use the ETag if it is strong

Here’s an example demonstrating how the new flag can be used:

task downloadFile(type: Download) {
    src ''
    dest buildDir
    overwrite true
    onlyIfNewer true
    useETag true

Download to temporary file and move afterwards

One of the most requested features was the possibility to download a file to a temporary location and, upon successful execution, move it to the final destination. This behavior can now be enabled with the new tempAndMove flag.

If the overwrite flag is set to false, tempAndMove can be used to avoid partially downloaded files if Gradle is forcefully closed or the system crashes. Note that the plugin always deletes partial downloads on connection errors, regardless of the value of this flag.

The temporary location can be configured through the new downloadTaskDir configuration property. The plugin appends the extension .part to all temporary files.

The following snippet shows how the new flag can be used:

task downloadFile(type: Download) {
    src ''
    dest buildDir
    tempAndMove true

Avoid unnecessary import statement

In previous versions, it was necessary to import the class to use the Download task. With the new version 3.4.0, this import statement is not needed anymore. The same applies to the Verify task.

Of course, the change is backwards compatible. You do not have to modify existing build scripts.

plugins {
    id '' version '3.4.0'
// import
task downloadFile(type: Download) {
    src ''
    dest buildDir

More information

If you want to learn more about the plugin, have a look at its README file or at my earlier post.

I also strongly advice to read my blog post on 10 recipes for gradle-download-task to get an idea what you can do with the plugin.

Profile image of Michel Krämer

Posted by Michel Krämer
on 4 March 2018

Next post

bson4jackson 2.9.2

This blog post summarizes the changes that came with the latest bson4jackson updates. Highlights are support for Decimal128, refactored serializers and deserializers, as well as support for Jackson 2.8 and 2.9.

Previous post

gradle-download-task 3.3.0

I’ve just published the new version 3.3.0 of the popular gradle-download-task plugin. This update contains (among other features) configurable timeouts, request and response interceptors, and updated integration tests.

Related posts

10 recipes for gradle-download-task

gradle-download-task is a Gradle plugin that allows you to download files during the build process. This post summarizes common patterns and use cases of gradle-download-task and provides useful tips and tricks.

New major version 5.0.0 of gradle-download-task

I’ve just released gradle-download-task 5.0.0. The new version now downloads multiple files in parallel, executes concurrently with other build tasks, and offers better support for Kotlin and Gradle 8.

gradle-download-task 2.0.0

The popular Gradle plugin now supports lazy source and destination properties. You can also configure it to ignore certificate errors, and it provides a new verify task. The plugin uses semantic versioning from now on.