Automatically update drivers

Getting tired of downloading the latest driver into your project? You might want to take a look at gradle-download-task. This plugin allows you to download files (over HTTP and HTTPS) to a specific destination directory.

Herewith a simple example:

 * Include the gradle-download-task plugin
plugins {
    id '' version '3.1.0'
apply plugin: 'java'
apply plugin: 'eclipse'
 * Import the Download task. This line is optional.
 * You can of course also always use the full qualified name
 * when you specify a task of type 'Download'.
 * The following two tasks download a ZIP file and extract its
 * contents to the build directory
task downloadZipFile(type: Download) {
    dest buildDir
    acceptAnyCertificate true
    overwrite true
task downloadAndUnzipFile(dependsOn: downloadZipFile, type: Copy) {
    from zipTree('build/')
    into 'src/main/resources'
    from tarTree('build/geckodriver-v0.9.0-mac.tar.gz')
    into 'src/main/resources'
defaultTasks 'downloadAndUnzipFile'

You only need to update the version numbers (from time to time) and the files will be downloaded and extracted. (eventually in src/main/resources)

Share This: