gradle-download-task 3.0.0

The new version of the Gradle plugin gradle-download-task 3.0.0 has just been released. The plugin provides a Download task that displays progress information while downloading files, just like Gradle does when it fetches an artifact from a repository.

Grab gradle-download-task 3.0.0 while it’s still hot:
https://github.com/michel-kraemer/gradle-download-task

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

New features

In the new version, the plugin’s core has been rewritten completely. gradle-download-task now uses Apache HttpClient instead of Java’s URLConnection. This enables a whole range of new features including support for authenticating proxies.

Proxy configuration

The new version allows you to configure a proxy server by setting standard JVM system properties. The plugin uses the same system properties as Gradle. You can set them in the build script directly. For example, the proxy host can be set as follows:

System.setProperty("http.proxyHost", "www.somehost.org");

Alternatively, you can set the properties in a gradle.properties file like this:

systemProp.http.proxyHost=www.somehost.org
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=userid
systemProp.http.proxyPassword=password
systemProp.http.nonProxyHosts=*.nonproxyrepos.com|localhost

Put this file in your project’s root directory or in your Gradle home directory.

HTTPS is also supported:

systemProp.https.proxyHost=www.somehost.org
systemProp.https.proxyPort=8080
systemProp.https.proxyUser=userid
systemProp.https.proxyPassword=password
systemProp.https.nonProxyHosts=*.nonproxyrepos.com|localhost

Automatically create target directory

gradle-download-task 3.0.0 automatically creates the target directory if multiple sources are set. For example, given the following task:

task downloadFile(type: Download) {
    src([
        'http://www.example.com/index.html',
        'http://www.example.com/test.html'
    ])
    dest "myTargetDirectory"
}

The target directory myTargetDirectory will be created automatically if it does not exist yet.

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 1 May 2016


Next post

Actson: a reactive (or non-blocking, or asynchronous) JSON parser

I’m thrilled to announce the first release of Actson, a reactive JSON parser. Actson is event-based and can be used together with reactive frameworks such as Vert.x to create highly responsive applications.

Previous post

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.

Related posts

New features in gradle-download-task 3.4.0

Version 3.4.0 of the popular Gradle plugin contains many new features. Highlights are the support for ETags and downloading to a temporary file. The update also contains various other improvements.

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.

5 anti-spam measures for phpBB 3.0

Discussion boards powered by phpBB are regularly targeted by spammers. Version 3 has introduced an improved Captcha but there are more possibilities to reduce spam. In this article, I present five useful and effective measures.