无法使用 Gradle 内的 Groovy VFS 库下载文件

Unable to download file using Groovy VFS library within Gradle

我正在尝试使用 Groovy-vfs 库在 gradle 脚本中使用 http 下载文件,但出现错误。这是 gradle 脚本:

plugins {
    id "org.ysb33r.vfs" version "1.0-beta6"
}
import org.ysb33r.groovy.dsl.vfs.VFS

apply plugin: 'com.android.application'

preBuild.dependsOn "copyDatabaseFile"

task copyDatabaeFile {
    def vfs = new VFS()
    vfs {
        cp "http://download.thinkbroadband.com/10MB.zip", "file:///Users/Me/"
    }
}

错误在 cp 行,并表示:

9:45:19 AM Gradle sync failed: Cause: org/apache/commons/httpclient/util/URIUtil
           Consult IDE log for more details (Help | Show Log)

来源 url/file 有效且存在。

我对 groovy 或 vfs 一无所知,我一直在尝试 google 获取教程或参考 material 将 vfs 与 groovy 结合使用,但是毫无结果。 知道问题出在哪里吗?

执行构建脚本时似乎缺少 org.apache.commons.httpclient.util.URIUtil class。要将 http/https 与此插件一起使用,您需要将 commons-httpclient 添加到您的依赖项中 - 就像文档中的这个片段:

buildscript {
    (...)
    dependencies {
        classpath 'commons-httpclient:commons-httpclient:3.1' // If you want http/https
    }
}

您可以在此处找到完整的文档:http://ysb33r.github.io/groovy-vfs/1.0-beta5/docs/product-documentation.html#_gradle_plugin