Code Monkey home page Code Monkey logo

gradle-download-task's Introduction

gradle-download-task

Download files in your Gradle build script with style progress and in parallel


Actions Status codecov Apache License, Version 2.0



This is a download task for Gradle. It displays progress information just like Gradle does when it retrieves an artifact from a repository. It is also able to download multiple files in parallel and supports concurrent execution with other tasks.

The plugin has been successfully tested with Gradle 5.0 up to 8.6. It should work with newer versions as well.

Who’s using gradle-download-task?

Facebook

React Native
Hermes

Website
GitHub repository


T. J. Watson Libraries
for Analysis (WALA)
6000+ more
open-source projects …


Want to be listed here?
Just comment on this issue.

Usage

First, apply the plugin configuration:

plugins {
    id "de.undercouch.download" version "5.6.0"
}

Then, use the Download task as follows:

task downloadFile(type: Download) {
    src 'http://www.example.com/index.html'
    dest layout.buildDirectory
}

By default, the plugin always performs a download even if the destination file already exists. If you want to prevent files from being downloaded again, use the overwrite flag (see description below).

task downloadFile(type: Download) {
    src 'http://www.example.com/index.html'
    dest layout.buildDirectory
    overwrite false
}

As an alternative to the Download task, you may also use the download extension to retrieve a file anywhere in your build script:

task myTask {
    doLast {
        // do something ...
        // ... then download a file
        download.run {
            src 'http://www.example.com/index.html'
            dest layout.buildDirectory
            overwrite false
        }
        // ... do something else
    }
}

Note that the download extension also has a runAsync method that downloads a file asynchronously. It returns a CompletableFuture that either completes successfully or exceptionally depending on whether the download has finished successfully or if it has failed. Make sure to always wait for the result of the CompletableFuture. Otherwise, errors might get lost.

Minimum requirements

The plugin requires:

  • Gradle 5.x or higher
  • Java 8 or higher

If you need to run the plugin with Gradle 2.x up to 4.x or Java 7, use gradle-download-task version 4.1.2.

Examples

Only download a file if it has been modified on the server

task downloadFile(type: Download) {
    src 'http://www.example.com/index.html'
    dest layout.buildDirectory
    onlyIfModified true
}

Note that this example only works if the server supports the If-Modified-Since request header and provides a Last-Modified timestamp in its response. If the server supports entity tags (ETags) you may use onlyIfModified together with useETag.

Concurrently download a list of files to a directory

task downloadMultipleFiles(type: Download) {
    src([
        'http://www.example.com/index.html',
        'http://www.example.com/test.html'
    ])
    dest layout.buildDirectory
}

Please note that you have to specify a directory as destination if you download multiple files. Otherwise, the plugin will fail.

Download files from a directory

If you want to download all files from a directory and the server provides a simple directory listing, you can use the following code:

task downloadDirectory {
    doLast {
        def dir = 'http://central.maven.org/maven2/de/undercouch/gradle-download-task/1.0/'
        def urlLister = new org.apache.ivy.util.url.ApacheURLLister()
        def files = urlLister.listFiles(new URL(dir))
        download.run {
           src files
           dest layout.buildDirectory
        }
    }
}

Download and extract a ZIP file

To download and unpack a ZIP file, you can combine the download task plugin with Gradle's built-in support for ZIP files:

task downloadZipFile(type: Download) {
    src 'https://github.com/michel-kraemer/gradle-download-task/archive/refs/tags/5.6.0.zip'
    dest layout.buildDirectory.file('5.6.0.zip')
}

task downloadAndUnzipFile(dependsOn: downloadZipFile, type: Copy) {
    from zipTree(downloadZipFile.dest)
    into layout.buildDirectory
}

More examples

Please have a look at the examples directory for more code samples. You can also read my blog post about common recipes for gradle-download-task.

Download task

The download task and the extension support the following properties.

General

src
The URL from which to retrieve the file. Can be a list of URLs if multiple files should be downloaded. (required)
dest
The file or directory where to store the file (required)
quiet
true if progress information should not be displayed (default: false)
overwrite
true if existing files should be overwritten (default: true)
onlyIfModified (alias: onlyIfNewer)
true if the file should only be downloaded if it has been modified on the server since the last download (default: false)
eachFile
If multiple download sources are specified, this method adds an action to be applied to each source URL before it is downloaded. The action is called with a DownloadDetails object and can modify some aspects of the target file in the destination directory (e.g. the filename or relative path). If only one download source has been given, adding an eachFile action will make the plugin fail.

Tip! You may provide Groovy Closures or Kotlin Lambdas to the src and dest properties to calculate their value at runtime.

Connection

acceptAnyCertificate
true if HTTPS certificate verification errors should be ignored and any certificate (even an invalid one) should be accepted. (default: false)
compress
true if compression should be used during download (default: true)
header
The name and value of a request header to set when making the download request (optional)
headers
A map of request headers to set when making the download request (optional)
connectTimeout
The maximum number of milliseconds to wait until a connection is established. A value of 0 (zero) means infinite timeout. Negative values are not allowed. (default: 30 seconds)
readTimeout
The maximum time in milliseconds to wait for data from the server. A value of 0 (zero) means infinite timeout. Negative values are not allowed. (default: 30 seconds)
retries
Specifies the maximum number of retry attempts if a request has failed. By default, requests are never retried and the task fails immediately if the first request does not succeed. If the value is greater than 0, failed requests are retried regardless of the actual error. This includes failed connection attempts and file-not-found errors (404). A negative value means infinite retries. (default: 0)

Authentication

username
The username that should be used if the server requires authentication (optional)
password
The password that should be used if the server requires authentication (optional)
preemptiveAuth
true if preemptive Basic authentication should be enabled. By default, gradle-download-task automatically detects the required authentication scheme by sending two requests: one without credentials to determine the scheme based on the WWW-Authenticate header in the server's response and the actual request with credentials. This will fail if the server does not send a WWW-Authenticate header. In this case, set preemptiveAuth to true to use Basic authentication and to always send credentials in the first request. Note: Sending credentials in clear text in the first request without checking if the server actually needs them might pose a security risk. (default: false)

Advanced

downloadTaskDir
The directory where the plugin stores information that should persist between builds. It will only be created if necessary. (default: ${layout.buildDirectory}/download-task)
tempAndMove
true if the file should be downloaded to a temporary location and, upon successful execution, moved to the final location. If overwrite is set to false, this flag is useful 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 default temporary location can be configured with the downloadTaskDir property. (default: false)
useETag
Use this flag in combination with onlyIfModified. If both flags 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 are:
false (default)
Do not use the ETag
true
Use the ETag but display a warning if it is weak
"all"
Use the ETag and do not display a warning if it is weak
"strongOnly"
Only use the ETag if it is strong
cachedETagsFile
The location of the file that keeps entity tags (ETags) received from the server. (default: ${downloadTaskDir}/etags.json)
method
The HTTP method to use (default: GET)
body
An optional request body. As gradle-download-task is meant for downloading and not for uploading, only simple strings are supported. (optional)
validateStatus
An optional status code validator. By default, a download fails if the HTTP status code is less than 200 or greater than 299 and does not equal 304 (Not Modified). This behavior can be customized by providing a validator. This function receives an integer (the HTTP status code) and either returns true if the status code should be accepted or false if it should be rejected (i.e. if the download should fail). Examples: validateStatus { it < 500 } or validateStatus { true }. (optional)

Verify task

The plugin also provides a Verify task that can be used to check the integrity of a downloaded file by calculating its checksum and comparing it to a pre-defined value. The task succeeds if the file’s checksum equals the given value and fails if it doesn’t.

Use the task as follows:

task verifyFile(type: Verify) {
    src layout.buildDirectory.file('file.ext')
    algorithm 'MD5'
    checksum 'ce114e4501d2f4e2dcea3e17b546f339'
}

You can combine the download task and the verify task as follows:

task downloadFile(type: Download) {
    src 'http://www.example.com/index.html'
    dest layout.buildDirectory
}

task verifyFile(type: Verify, dependsOn: downloadFile) {
    src layout.buildDirectory.file('index.html')
    algorithm 'MD5'
    checksum '09b9c392dc1f6e914cea287cb6be34b0'
}

The verify task supports the following properties:

src
The file to verify (required)
checksum
The actual checksum to verify against (required)
algorithm
The algorithm to use to compute the checksum. See the list of algorithm names for more information. (default: MD5)

DownloadDetails

If you specify an eachFile action, it will be called with an instance of the DownloadDetails class, which provides details about a download source and its target file. It can be used to change some aspects of the target file (e.g. its name or relative path).

DownloadDetails provides the following properties:

URL sourceURL (read-only)
The source URL of the file to be downloaded
String name
The name of the target file
String path
The path of the target file (including the filename), relative to download directory
RelativePath relativePath
The path of the target file (including the filename), relative to download directory

Example

eachFile { f ->
    f.name = f.name.toLowerCase()
    if (f.sourceURL.path.toLowerCase().endsWith(".jpg")) {
        f.path = "images/" + f.path
    }
}

Proxy configuration

You can 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

Migrating from version 4.x to 5.x

gradle-download-task 5.0.0 introduces the following breaking changes:

  • The authScheme property has been removed. The plugin now automatically detects the correct scheme to use based on the server response.
  • The download extension was incompatible with Gradle 8. Also, using it from Kotlin build scripts was rather inconvenient. It is therefore now necessary to call the extension through its run method. Replace download { ... } with download.run { ... }. The same applies to the verify extension.

Migrating from version 3.x to 4.x

In gradle-download-task 4.x, we made the following breaking changes to the API:

  • The plugin now requires Gradle 2.x (or higher) and Java 7 (or higher)
  • We removed the timeout property and introduced connectTimeout and readTimeout instead. This allows you to control the individual timeouts better. Also, it improves compatibility with Gradle 5.x, where all tasks have a timeout property by default.
  • The credentials property has been removed. The same applies to the possibility to pass instances of Apache HttpClient’s AuthScheme to the authScheme property. The strings Basic and Digest are now the only accepted values. There is no replacement. If you need this functionality, please file an issue.
  • The properties requestInterceptor and responseInterceptor have been removed. There is no replacement. Again, if you need this functionality, please file an issue.

License

The plugin is licensed under the Apache License, Version 2.0.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

gradle-download-task's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gradle-download-task's Issues

Support the --offline command line switch

Feature Request:

The gradle-download-task should support the --offline command line switch and should neither attempt to download a file, nor check if a newer version exists if the onlyIfNewer property is used. If the file exists (as a result of a download executed earlier), the task should exit successfully, else it should fail.

It may not be feasible when downloading a directory, but it should be possible to implement when the dest is a single file as in the downloadZipFile task that was copied from the examples in the README.md.

ask downloadZipFile(type: Download) {
    src 'https://github.com/michel-kraemer/gradle-download-task/archive/1.0.zip'
    dest new File(buildDir, '1.0.zip')
}

Dependency: 'de.undercouch:gradle-download-task:2.0.0

Add lazy evaluation for src and dest configuration

Most Gradle Tasks are capable of lazily evaluating their configuration just before execution, but the Download task isn't. So doing something like documented in the user guide isn't possible. I'd like to be able to pass a closure to src and dest so it is evaluated just before execution and therefore control the url with a variable that is set elsewhere in the build script, a bit like:

task('downloadReleng', type: Download) { 
   src { "${baseUrl}/${version}" }
   dest { "${baseDest}/${version}" }
}

I want to be able to do that so that a plugin that provides a download task can be configured easily. Since the download task is configured during the plugin.apply call but the variables are not properly defined yet, this doesn't work. The workaround is to declare the task but configure it in an afterEvaluate block, which solves my issue but might not be ideal.

mirrors

Hi
Pls add support for multiple urls for a single file
So first successful download should stop subsequent requests

Incorrect gradle is used for tag 1.1

Accordingly to documentation gradle-download-task for tag 1.1 should work for gradle 1.x but it doesn't. The problem is happening when you use onlyIfNewer = true or overwrite = false. The reason is - that the project is build with Gradle 2.1 and running the line 48 in the class Download gives an error about not existing method.

Could you please amend documentation about version compatibility or fix this problem?

Thanks! :)

download seems to be broken again wrt progresslogger for gradle 2.7.

Maybe we should just not use progresslogger any more and use logger lifecycle or some such instead. Works if you run with --quiet as it skips this code block.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':prepareAnalytics'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:62)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
    at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
Caused by: java.lang.NoSuchMethodError: org.gradle.logging.ProgressLogger.setDescription(Ljava/lang/String;)V
    at de.undercouch.gradle.tasks.download.DownloadAction.execute(DownloadAction.java:139)
    at de.undercouch.gradle.tasks.download.DownloadAction.execute(DownloadAction.java:88)
    at de.undercouch.gradle.tasks.download.DownloadExtension.configure(DownloadExtension.java:44)
    at de.undercouch.gradle.tasks.download.DownloadExtension.configure(DownloadExtension.java:29)
    at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:59)
    at org.gradle.api.internal.plugins.ExtensionsStorage$ExtensionHolder.configure(ExtensionsStorage.java:145)
    at org.gradle.api.internal.plugins.ExtensionsStorage.configureExtension(ExtensionsStorage.java:69)
    at org.gradle.api.internal.plugins.DefaultConvention$ExtensionsDynamicObject.invokeMethod(DefaultConvention.java:207)
    at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:150)
    at org.gradle.groovy.scripts.BasicScript.methodMissing(BasicScript.java:79)
    at analytics_4y63yhsnzsqc3hu3cs2amygbb$_run_closure2.doCall(/Users/.../projects/.../build/gradle/task/browser_tests/analytics.gradle:24)

Downloading large files.

When download a large file, for example * .zip. I stop building before the download is complete - but file is created in destination dir, this file is broken.
In next executions my file is not downloaded again. because i use overwrite = false:

download {
        src url
        dest browserZip
        overwrite false
        onlyIfNewer true
    }

I suggest using a two-phase downloading. First, use temporary file with the autogenerated name after that rename it to the target file

Create Directory if multiple Files are downloaded

This is my build.gradle (the example is fully self contained and I tested it with gradle 2.12)

buildscript {
    repositories {
        jcenter()
    }
}

plugins {
    id "de.undercouch.download" version "2.1.0"
}

repositories {
    jcenter()
}

import de.undercouch.gradle.tasks.download.Download

task download(type: Download) {
    src([
        'http://central.maven.org/maven2/org/citationstyles/styles/1.0/styles-1.0.jar',
        'http://central.maven.org/maven2/org/eclipse/jetty/jetty-server/9.1.3.v20140225/jetty-server-9.1.3.v20140225-javadoc.jar'
    ])
    dest 'vendor'
}

defaultTasks 'download'

I would expect this build to create a vendor directory, it it does not exist.

What happens is

:download FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':download'.
> If multiple sources are provided the destination has to be a directory.

Our workaround is to create the directory in doFirst of the task.

    doFirst {
        // The plug-in does not create the output directory by itself.
        // So, we have to do it before the download starts.
        dest.mkdirs()
    }

Would it be possible to implement this in the plugin? I think that in the case of more then one source-files, it is clear that dest can not be a file name, but rather must be a directory.

Change in Gradle 2.6 breaks download task

Hi, I just tried updating to gradle 2.6, and I get this exception:

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':download'.
    at (snip)
Caused by: java.lang.NoSuchMethodError: org.gradle.logging.ProgressLogger.setDescription(Ljava/lang/String;)V
    at de.undercouch.gradle.tasks.download.DownloadAction.execute(DownloadAction.java:139)
    at de.undercouch.gradle.tasks.download.DownloadAction.execute(DownloadAction.java:88)
    at de.undercouch.gradle.tasks.download.Download.download(Download.java:45)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:226)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:219)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:208)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:585)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:568)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
    ... 68 more

It may be related to this change: gradle/gradle@9f04302#diff-f3941464cb83476ea37bc67c9da36883L55

It's not an immediate problem, I just downgraded back to gradle 2.5 for now, but I thought I would let you know.

Cannot set the value of read-only property 'overwrite' on task

Hi,

i'm trying to set custom properties to prevent Gradle from downloading large files each time I compile the project.

task downloadBoostHeaders(type: Download) {
    src 'http://deps.mihosoft.eu/boost/1.58.0/headers/boost.zip'
    dest "$projectDir/src/main/native/ext/headers/boost.zip"

    overwrite = false
}

Gradle 2.4 gives me the following error:

Cannot set the value of read-only property 'overwrite' on task 

File download failed.

Hi Michel,

first of all thanks for your plugin. I've tried to download a file but unfortunately it fails - the size of the downloaded file is 0. The following code describes in much more details what I've tried to do.

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'de.undercouch:gradle-download-task:0.2'
}
}

import de.undercouch.gradle.tasks.download.Download

String url="https://bitbucket.org/kobo/groovyserv-mirror/downloads/groovyserv"
String version="0.13"
String platform="linux-amd64-bin"
String archive="zip"

String source="${url}-${version}-${platform}.${archive}"

task downloadFile(type: Download) {
src source
dest buildDir
}

Any Idea how to fix it?

Cheers,

-markus

Plugin with id 'download-task' not found... Exception...

I'm using Gradle 2.2, but using the older style classpath and "apply plugin "download-task" As I can't use the plugin {} style syntax - as there is no way to use that style on air-gapped networks which also require authorization to access the repository

Unfortunately, I can't get around this issue - which is preventing from using the download method()

Any idea what I'm doing wrong? Thanks for any assistance.
Phil

Allow name of each downloaded file to be specified

Servers don't always provide good names for downloaded files. It would be nice to be able to set names for individual urls, like this:

src = [
    'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD':'config.guess',
    'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD':'config.sub'
]

If you create a read-write property Map src, and make method src(...) add stuff to that property (both individual urls, lists and maps), it would be done (almost) without breaking compatibility.

Failing in Gradle 2.0

I tried the following under Gradle 2.0

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'de.undercouch:gradle-download-task:1.0'
    }
}

apply plugin: 'download-task'

task downloadVBoxPatch(type: Download) {
    src 'https://www.virtualbox.org/download/testcase/VBoxGuestAdditions_4.3.13-94832.iso'
    dest iso
    overwrite true
}

and got

C:\workspaces\CIBOX\cibox-testing\base-vm>gradle downloadVBoxPatch
Download http://repo1.maven.org/maven2/org/apache/ivy/ivy/2.3.0/ivy-2.3.0.pom
Download http://repo1.maven.org/maven2/org/apache/ivy/ivy/2.3.0/ivy-2.3.0.jar

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\workspaces\CIBOX\cibox-testing\base-vm\build.gradle' line: 23 

* What went wrong:
A problem occurred evaluating root project 'base-vm'.
> Could not find property 'Download' on root project 'base-vm'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Any hints appreciated

SSLPeerUnverifiedException

Until today we used Gradle 2.13 and your download task plugin version 2.0.0 in our Android project. We wanted to upgrade Gradle to 2.14.1 and were forced to upgrade your plugin to latest version because of the ProgressLogger, too.

I'm getting this exception now while downloading a file. It's very likely related to #48, but moving the download task to the root project isn't an option for us since the task depends on another task from the Android Gradle plugin. The exception isn't caused by Gradle or the Android plugin. If I don't change anything in the build script, use Gradle 2.13 and your plugin version 2.1.0, then everything is working. However, if I upgrade your plugin to 3.0.0 the exception occurs.

The only workaround I have so far is keep the old versions (living in the past isn't really an option) or to set acceptAnyCertificate = true, what I definitely don't want to do. Is there a different solution? What has changed in your plugin?

Caused by: javax.net.ssl.SSLPeerUnverifiedException: Host name 'evernote.s3.amazonaws.com' does not match the certificate subject provided by the peer (CN=*.s3.amazonaws.com, O=Amazon.com Inc., L=Seattle, ST=Washington, C=US)
        at org.apache.http.conn.ssl.SSLConnectionSocketFactory.verifyHostname(SSLConnectionSocketFactory.java:465)
        at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:395)
        at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:353)
        at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:134)
        at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
        at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
        at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
        at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
        at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
        at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
        at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
        at de.undercouch.gradle.tasks.download.DownloadAction.openConnection(DownloadAction.java:430)
        at de.undercouch.gradle.tasks.download.DownloadAction.execute(DownloadAction.java:191)
        at de.undercouch.gradle.tasks.download.DownloadAction.execute(DownloadAction.java:140)
        at de.undercouch.gradle.tasks.download.DownloadExtension.configure(DownloadExtension.java:44)

Allow customization of SSL client verification

It would be really useful to have one or more of the following for dealing with non-public certificates (which often come up in corporate environments):

  • specifying a trust store
  • turning off host verification

Failing to initialize org.apache.http.conn.ssl.SSLConnectionSocketFactory

* What went wrong:
Execution failed for task ':desktop:downloadMultipleFiles'.
> Could not initialize class org.apache.http.conn.ssl.SSLConnectionSocketFactory

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':desktop:downloadMultipleFil                                                                                                         es'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(Execute                                                                                                         ActionsTaskExecuter.java:69)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActions                                                                                                         TaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExe                                                                                                         cutionAnalysisTaskExecuter.java:35)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTask                                                                                                         Executer.java:66)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExec                                                                                                         uter.java:58)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmpt                                                                                                         ySourceFilesTaskExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWit                                                                                                         hNoActionsExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExec                                                                                                         uter.java:53)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMo                                                                                                         stOnceTaskExecuter.java:43)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(Def                                                                                                         aultTaskGraphExecuter.java:203)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(Def                                                                                                         aultTaskGraphExecuter.java:185)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(Ab                                                                                                         stractTaskPlanExecutor.java:66)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTa                                                                                                         skPlanExecutor.java:50)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.ja                                                                                                         va:25)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.                                                                                                         java:110)
        at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java                                                                                                         :37)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
        at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
        at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
        at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:3                                                                                                         2)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
        at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:153)
        at org.gradle.internal.Factories$1.create(Factories.java:22)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecu                                                                                                         tor.java:91)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecu                                                                                                         tor.java:53)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:                                                                                                         150)
        at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
        at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:98)
        at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:92)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecu                                                                                                         tor.java:91)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecu                                                                                                         tor.java:63)
        at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:92)
        at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:83)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProces                                                                                                         sBuildActionExecuter.java:99)
        at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunne                                                                                                         r.java:28)
        at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecute                                                                                                         r.java:48)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecute                                                                                                         r.java:30)
        at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecu                                                                                                         ter.java:81)
        at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecu                                                                                                         ter.java:46)
        at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:52)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecuti                                                                                                         on.java:120)
        at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnectio                                                                                                         n.java:37)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecuti                                                                                                         on.java:120)
        at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLog                                                                                                         ger.java:26)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecuti                                                                                                         on.java:120)
        at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopI                                                                                                         fSingleUsedDaemon.java:34)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecuti                                                                                                         on.java:120)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:                                                                                                         74)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:                                                                                                         72)
        at org.gradle.util.Swapper.swap(Swapper.java:38)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java                                                                                                         :72)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecuti                                                                                                         on.java:120)
        at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.                                                                                                         java:47)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecuti                                                                                                         on.java:120)
        at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecuti                                                                                                         on.java:120)
        at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEn                                                                                                         vironment.java:72)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecuti                                                                                                         on.java:120)
        at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:4                                                                                                         1)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecuti                                                                                                         on.java:120)
        at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrResp                                                                                                         ondWithBusy.java:50)
        at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.jav                                                                                                         a:237)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPo                                                                                                         licy.java:54)
        at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.http.conn.ssl.SSLCo                                                                                                         nnectionSocketFactory
        at org.apache.http.impl.client.HttpClientBuilder.build(HttpClientBuilder.java:955)
        at de.undercouch.gradle.tasks.download.DownloadAction.createHttpClient(DownloadAction.java:3                                                                                                         65)
        at de.undercouch.gradle.tasks.download.DownloadAction.execute(DownloadAction.java:187)
        at de.undercouch.gradle.tasks.download.DownloadAction.execute(DownloadAction.java:140)
        at de.undercouch.gradle.tasks.download.Download.download(Download.java:62)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskA                                                                                                         ction.doExecute(AnnotationProcessingTaskFactory.java:228)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskA                                                                                                         ction.execute(AnnotationProcessingTaskFactory.java:221)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskA                                                                                                         ction.execute(AnnotationProcessingTaskFactory.java:210)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:621)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:604)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteA                                                                                                         ctionsTaskExecuter.java:80)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(Execute                                                                                                         ActionsTaskExecuter.java:61)
        ... 68 more

Gradle HTTPS/SSL Issue

:downloadZipFile'.

Could not initialize class org.apache.http.conn.ssl.SSLConnectionSocketFactory

Trying do download anything http or https results in this error

Using Gradle 2.10

Regression with 1.11?

Just updated my wrapper from 1.8 to 1.11 and then I got this:

org.gradle.tooling.BuildException: Could not execute build using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.11-bin.zip'.
at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:53)
at org.gradle.tooling.internal.consumer.async.DefaultAsyncConnection$2.run(DefaultAsyncConnection.java:71)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.gradle.internal.exceptions.LocationAwareException: Execution failed for task ':downloadVertx'.
at org.gradle.initialization.DefaultExceptionAnalyser.transform(DefaultExceptionAnalyser.java:77)
at org.gradle.initialization.MultipleBuildFailuresExceptionAnalyser.transform(MultipleBuildFailuresExceptionAnalyser.java:47)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:115)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64)
at org.gradle.tooling.internal.provider.BuildModelAction.run(BuildModelAction.java:70)
at org.gradle.tooling.internal.provider.BuildModelAction.run(BuildModelAction.java:30)
at org.gradle.tooling.internal.provider.ConfiguringBuildAction.run(ConfiguringBuildAction.java:108)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35)
at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:45)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:42)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:24)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
at org.gradle.launcher.daemon.server.exec.StartStopIfBuildAndStop.execute(StartStopIfBuildAndStop.java:33)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
at org.gradle.launcher.daemon.server.exec.ReturnResult.execute(ReturnResult.java:34)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:71)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:69)
at org.gradle.util.Swapper.swap(Swapper.java:38)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:69)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:60)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:45)
at org.gradle.launcher.daemon.server.DaemonStateCoordinator.runCommand(DaemonStateCoordinator.java:186)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy.doBuild(StartBuildOrRespondWithBusy.java:49)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:34)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
at org.gradle.launcher.daemon.server.exec.HandleStop.execute(HandleStop.java:36)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
at org.gradle.launcher.daemon.server.exec.DaemonHygieneAction.execute(DaemonHygieneAction.java:39)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
at org.gradle.launcher.daemon.server.exec.CatchAndForwardDaemonFailure.execute(CatchAndForwardDaemonFailure.java:32)
at org.gradle.launcher.daemon.server.exec.DaemonCommandExecution.proceed(DaemonCommandExecution.java:125)
at org.gradle.launcher.daemon.server.exec.DefaultDaemonCommandExecuter.executeCommand(DefaultDaemonCommandExecuter.java:51)
at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.handleCommand(DefaultIncomingConnectionHandler.java:155)
at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.receiveAndHandleCommand(DefaultIncomingConnectionHandler.java:128)
at org.gradle.launcher.daemon.server.DefaultIncomingConnectionHandler$ConnectionWorker.run(DefaultIncomingConnectionHandler.java:116)
at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':downloadVertx'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:289)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:23)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:86)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:166)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
... 47 more
Caused by: java.lang.NoSuchMethodError: org.gradle.api.internal.project.ProjectInternal.getServices()Lorg/gradle/internal/service/scopes/ServiceRegistryFactory;
at de.undercouch.gradle.tasks.download.DownloadAction.execute(DownloadAction.java:110)
at de.undercouch.gradle.tasks.download.Download.download(Download.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:219)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:212)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:201)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:533)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:516)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 70 more

Unable to pass strings with tokens

I would like to send a url that varies at run time. For example:
"http://download.oracle.com/otn-pub/java/jdk/${minor}u${update}-b${build}/jre-${minor}u${update}-windows-x64.${extension}"

On my code it translates correctly to:
http://download.oracle.com/otn-pub/java/jdk/8u74-b02/jre-8u74-windows-x64.exe

But gives out the following error:

Cannot set readonly property: src for class: de.undercouch.gradle.tasks.download.DownloadAction

Using the hard coded URL works perfectly.

problem of file download after proxy

Hi Michel,

Thanks for the nice work!

I am capable of using gradle-download-task while there is no proxy to access the internet (to download files from dropbox). But when I am running behind proxy, it does not work. Any suggestions please ?

Thanks!

Ye

Download .jar file

Hi.

When I try to download a jar file, I have this error:

org.apache.http.client.ClientProtocolException

Thanks!

Gradle 2.14 break

ProgressLogger doesn't exist in the same class path (moved to gradle.internal) which I don't think is even importable anymore. Should probable just ditch ProgressLogger all together as of 2.14

Support verification via md5 checksum file

It would be useful to support md5 verification via files that contain content like this, quite often used by Apache projects.

f585fb1a782d5d074f855e86570d3309 *testfile.zip

possible to only re-download when the download link changes

Is it possible to set up the download task so that if the file will be downloaded only when it doesn't exist locally or when the src url has changed?

I'd like to avoid re-downloading every time I build, but I want to be sure that when the version of the file we need changes, that it will be updated. overwrite false doesn't seem to behave this way, and neither does onlyIfNewer.

HTTP status 302 FOUND

Im in trouble downloading file from Dropbox. There is HTTP 302 redirect to temporary link for file download. You can try it with this URL:

https://www.dropbox.com/s/hqibjpiiw5fayu8/aaa.txt?dl=1

My task:

task downloadFile << {
    download {
        src 'https://www.dropbox.com/s/hqibjpiiw5fayu8/aaa.txt?dl=1'
        dest '.'
    }
}

failes with exception and message:

"Could not download file"

http.nonProxyHosts system property ignored

Hi,

It seems the plugin ignores the properties http.nonProxyHosts and https.nonProxyHosts.

For example, I get a HttpHostConnectException if I try to download a file from Google and I pass non-existent proxy settings, while ignoring *.google.com at the same time:

gradle downloadFile -Dhttp.proxyHost=localhost -Dhttp.proxyPort=999 -Dhttp.nonProxyHosts=*.google.com -Dhttps.nonProxyHosts=*.google.com

Thanks!

Failed to load native library 'libnative-platform.so' for Linux amd64.

I am using your plugin and attempting to download a file (.apk) from a nexus repository. When attempting to run this task:

[task myTask << {
//do something ...
//... then download a file
download {
src 'http://www.example.com/index.html'
dest buildDir
}
//... do something else
}]

I am getting the following error:

FAILURE: Build failed with an exception.

  • What went wrong:
    Failed to load native library 'libnative-platform.so' for Linux amd64.

No progress information displayed

I'm not seeing progress bar for downloading https://github.com/swagger-api/swagger-ui/archive/v2.1.4.zip. No matter if I go with https or without.
I attach the minimum file for this at the end (zipped for github restrictions)

$ gradle -b downloader.gradle downloadAndUnzipFile
:downloadZipFile
Unable to get progress logger. Download progress will not be displayed.
Invalid cookie header: "Set-Cookie: logged_in=no; domain=.github.com; path=/; expires=Mon, 07 Jul 2036 20:41:58 -0000; secure; HttpOnly". Invalid 'expires' attribute: Mon, 07 Jul 2036 20:41:58 -0000
:downloadAndUnzipFile

BUILD SUCCESSFUL

Total time: 6.687 secs

This build could be faster, please consider using the Gradle Daemon: https://docs.gradle.org/2.14/userguide/gradle_daemon.html
$ gradle -v

------------------------------------------------------------
Gradle 2.14
------------------------------------------------------------

Build time:   2016-06-14 07:16:37 UTC
Revision:     cba5fea19f1e0c6a00cc904828a6ec4e11739abc

Groovy:       2.4.4
Ant:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM:          1.8.0_91 (Oracle Corporation 25.91-b14)
OS:           Mac OS X 10.11.5 x86_64

downloader.gradle.zip

NoClassDefFoundError while downloading on Gradle-3.0-milestone-1

Since ProgressLogger was moved the following exception is thrown while downloading

Caused by: java.lang.NoClassDefFoundError: Lorg/gradle/logging/ProgressLogger;
    at org.gradle.internal.metaobject.BeanDynamicObject.getMetaClass(BeanDynamicObject.java:139)
    at org.gradle.internal.metaobject.BeanDynamicObject.access$400(BeanDynamicObject.java:55)
    at org.gradle.internal.metaobject.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:379)
    at org.gradle.internal.metaobject.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:170)
    at org.gradle.internal.metaobject.ConfigureDelegate.invokeMethod(ConfigureDelegate.java:59)
    at build_bde9ot97vy9vu4gqda0wc6vps$_downloadAndUnzip_closure9.doCall(/Users/zolotov/dev/intellij-plugins/intellij-go/build.gradle:128)
    at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:70)
    at org.gradle.util.ConfigureUtil.configureTarget(ConfigureUtil.java:160)
    at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:106)
    at de.undercouch.gradle.tasks.download.DownloadExtension.configure(DownloadExtension.java:42)
    at de.undercouch.gradle.tasks.download.DownloadExtension.configure(DownloadExtension.java:29)
    at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:104)
    at org.gradle.util.ConfigureUtil$1.execute(ConfigureUtil.java:123)
    at org.gradle.api.internal.plugins.ExtensionsStorage$ExtensionHolder.configure(ExtensionsStorage.java:145)
    at org.gradle.api.internal.plugins.ExtensionsStorage.configureExtension(ExtensionsStorage.java:69)
    at org.gradle.api.internal.plugins.DefaultConvention$ExtensionsDynamicObject.invokeMethod(DefaultConvention.java:215)
    at org.gradle.internal.metaobject.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:96)
    at org.gradle.internal.metaobject.MixInClosurePropertiesAsMethodsDynamicObject.invokeMethod(MixInClosurePropertiesAsMethodsDynamicObject.java:30)
    at org.gradle.internal.metaobject.AbstractDynamicObject.invokeMethod(AbstractDynamicObject.java:163)
    at org.gradle.groovy.scripts.BasicScript.methodMissing(BasicScript.java:79)
    at build_bde9ot97vy9vu4gqda0wc6vps.downloadAndUnzip(/Users/zolotov/dev/intellij-plugins/intellij-go/build.gradle:127)
    at build_bde9ot97vy9vu4gqda0wc6vps$_run_closure7.doCall(/Users/zolotov/dev/intellij-plugins/intellij-go/build.gradle:103)
    at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:587)
    at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:568)
    at org.gradle.api.internal.tasks.TaskMutator$1.execute(TaskMutator.java:80)
    at org.gradle.api.internal.tasks.TaskMutator$1.execute(TaskMutator.java:76)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
    ... 71 more

Support authenticated Proxies

Hi Michel,

my company just introduced a new authenticated proxy and half of all build tools went to hell:
Sadly the download task is one of those not working.

I tried to create a minimal examle:
This buildfile downloads the gradle-download-task (through the proxy - working for gradle 2.12 - not working for gradle 2.7) but fails during the download task.

// build.gradle
buildscript {
    repositories {
        mavenCentral()    
    }
}

plugins {
    id "de.undercouch.download" version "2.1.0"
}

import de.undercouch.gradle.tasks.download.Download

ant.'nexus-version'='2.9.1'

repositories {
    mavenCentral()    
}

task downloadNexus(type: Download) {
    src( "https://download.sonatype.com/nexus/oss/nexus-${ant.'nexus-version'}.war")
    new File(buildDir, "downloads/nexus-${ant.'nexus-version'}.war")
    dest "${buildDir}/target/webapp/nexus.war"
}
#gradle.properties
# not working
systemProp.http.proxyHost=ourProxySupportingBasicAuth
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=user
systemProp.http.proxyPassword=password
systemProp.http.nonProxyHosts=localhost|*.some-domain.com

systemProp.https.proxyHost=ourProxySupportingBasicAuth
systemProp.https.proxyPort=8080
systemProp.https.proxyUser=user
systemProp.https.proxyPassword=password
systemProp.https.nonProxyHosts=localhost|*.some-domain.com


# cnltm configuration - cntlm forwards to our proxy but takes over authentication - works flawlessly
# even for gradle --debug downloadNexus
#systemProp.http.proxyHost=localhost
#systemProp.http.proxyPort=3128

#systemProp.https.proxyHost=localhost
#systemProp.https.proxyPort=3128

Here is the (slightly redacted) log of gradlew --refresh-dependencies --debug downloadNexus
Attaching the log is currently not working for me. I'll send you an email.

I hope this is useful.

Thanks in advance

Plugin doesn't work with the latest nightly (1.12-20140127015041+0000)

Hi,

Lovely plugin, thanks for putting it together. Just raising this as I noticed the plugin doesn't work with the 1.12-20140127015041+0000 nightly Gradle build. The error I get is:

Caused by: java.lang.NoSuchMethodError: org.gradle.api.internal.project.ProjectInternal.getServices()Lorg/gradle/internal/service/scopes/ServiceRegistryFactory;
    at de.undercouch.gradle.tasks.download.DownloadAction.execute(DownloadAction.java:110)
    at de.undercouch.gradle.tasks.download.Download.download(Download.java:46)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:219)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:212)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:201)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:533)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:516)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)

From what I can tell this is due to the plugin's use of org.gradle.api.internal.project.ProjectInternal, which I think is an internal Gradle API and therefore subject to change without notice. I'm guessing the getServices() method has been removed at some point in this case?

Anyhoo, thought I'd mention this in case it's of some benefit.

Cheers,

Edd

Handle *.domain when checking SSL certificates.

When downloading from Github releases I had the following error:

javax.net.ssl.SSLPeerUnverifiedException: Host name 'github-cloud.s3.amazonaws.com' does not match the certificate subject provided by the peer (CN=*.s3.amazonaws.com, O=Amazon.com Inc., L=Seattle, ST=Washington, C=US)

But github-cloud.s3.amazonaws.com match *.s3.amazonaws.com! So this should not produce the error.

Task type Download import not found

I follow the instructions in the README file and get the error:

unable to resolve class de.undercouch.gradle.tasks.download.Download
@ line 10, column 1.
import de.undercouch.gradle.tasks.download.Download

Gradle version 1.12

Support up-to-date checks

Would it be possible to also support gradle's up-to-date checking mechanism to avoid re-downloading the same file over and over again?

This could be supported by checking the HTTP header's "Last-Modified" timestamp with the local file, before actually downloading it.

Alternatively (and simpler) would be to check if a local file exists with the same name as the file that is specified in the URL. This approach wouldn't re-download the file even if has changed, though.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.