gradle-download-task 3.0.0

The new ver­sion of the Gradle plug­in gradle-down­load-task 3.0.0 has just been re­leased. The plug­in provides a Download task that dis­plays pro­gress in­form­a­tion while down­load­ing files, just like Gradle does when it fetches an ar­ti­fact from a re­pos­it­ory.

Grab gradle-down­load-task 3.0.0 while it’s still hot:

The new ver­sion has been tested with Gradle 1.x up to 2.13 but should be com­pat­ible to any other ver­sion as well.

New features

In the new ver­sion the plu­gin’s core has been re­writ­ten com­pletely. gradle-down­load-task now uses Apache Ht­tp­Cli­ent in­stead of Java’s URLConnection. This en­ables a whole range of new fea­tures in­clud­ing sup­port for au­then­tic­at­ing prox­ies.

Proxy configuration

The new ver­sion al­lows you to con­fig­ure a proxy server by set­ting stand­ard JVM sys­tem prop­er­ties. The plug­in uses the same sys­tem prop­er­ties as Gradle. You can set them in the build script dir­ectly. For ex­ample, the proxy host can be set as fol­lows:

System.setProperty("http.proxyHost", "");

Al­tern­at­ively, you can set the prop­er­ties in a file like this:

Put this file in your pro­ject’s root dir­ect­ory or in your Gradle home dir­ect­ory.

HT­TPS is also sup­por­ted:

Automatically create target directory

gradle-down­load-task 3.0.0 auto­mat­ic­ally cre­ates the tar­get dir­ect­ory if mul­tiple sources are set. For ex­ample, given the fol­low­ing task:

task downloadFile(type: Download) {
    dest "myTargetDirectory"

The tar­get dir­ect­ory myTargetDirectory will be cre­ated auto­mat­ic­ally if it does not ex­ist yet.

More information

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

I also strongly ad­vice to read my blog post on 10 re­cipes for gradle-down­load-task to get an idea what you can do with the plug­in.

Posted by Michel Krämer
on May, 1st 2016.