Gradle fails to download a dependency if HTTP HEAD is not supported by a web server


(marek.wiacek) #1

The script included below fails with the following error:

./gradlew clean extractValidator

Could not resolve all dependencies for configuration ‘:vnuValidator’.
Could not resolve :vnu:15.4.12.
Required by:
:gradle-dep-head:unspecified
Could not HEAD ‘http://github.com/validator/validator/releases/download/15.4.12/vnu.jar_15.4.12.zip’. Received status code 403 from server: Forbidden

repositories {
ivy {
url "http://github.com/validator/validator/releases/download/"
layout “pattern”, {
artifact “[revision]/[module].jar_[revision].[ext]”
}
}
}

apply plugin: “java”

configurations {
vnuValidator
}

dependencies {
vnuValidator “:vnu:15.4.12@zip”
}

task extractValidator(type: Copy) {
configurations.vnuValidator.each{zipTree(it)}
into “$buildDir/vnu”
}


Use GitHub Releases as dependency repository (Plugin?)
(marek.wiacek) #2

The problem was observed in Gradle 2.2.1.


(IsNull) #3

I just ran into the same issue in my attempt to use GitHub Releases as Maven Repository use-github-releases-as-dependency-repository-plugin

Btw, I’ve generalised the Ivy repo, as long as the jars follow default naming conventions.

    ivy {
        url 'https://github.com/IsNull'
        layout ('pattern') {
            artifact '[organisation]/releases/download/v[revision]/[artifact]-[revision](-[classifier])(.[ext])'
        }
    }

This way, the dependency can be specified simply as

dependencies {
    compile("MyRepository:my-artifact:0.1.3")
   ...

}