Gradle 2.8 can not resolve dependency

After updating the Gradle to version 2.8 I am facing a problem during dependency resolution and eventually the build fails with timeout:

Could not resolve all dependencies for configuration ‘:classpath’.

Could not resolve nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0.
Required by:
:feign-vnderror-spring-cloud-starter:1.2.1-SNAPSHOT
Could not resolve nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0.
Could not get resource ‘https://plugins.gradle.org/m2/nl/javadude/gradle/plugins/license-gradle-plugin/0.11.0/license-gradle-plugin-0.11.0.pom’.
Could not HEAD ‘https://plugins.gradle.org/m2/nl/javadude/gradle/plugins/license-gradle-plugin/0.11.0/license-gradle-plugin-0.11.0.pom’.
The target server failed to respond

Any idea?

Everything works fine with version 2.7.

Could you please provide the plugin definition from your build script?

Sure, it’s available online: https://github.com/jmnarloch/feign-vnderror-spring-cloud-starter/blob/master/build.gradle

Seems to work fine for me with Gradle 2.8. I am using this script:

plugins {
    id "com.github.hierynomus.license" version "0.11.0"
}

apply plugin: 'java'
apply plugin: 'license'

license {
    header rootProject.file('codequality/HEADER')
    strictCheck true
    skipExistingHeaders true
    include "**/*.java"

    ext.year = Calendar.getInstance().get(Calendar.YEAR)
}

dependencies {
    compile "commons-lang:commons-lang:2.5"
}

repositories {
    mavenCentral()
    jcenter()
}

Can you try to run this build in your environment?

I’ve replaced the script, but it does not change anything no matter whether I’m running it through gradle/gradlew for version 2.8 I have the same result:

Starting a new Gradle Daemon for this build (subsequent builds will be faster).

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'feign-vnderror-spring-cloud-starter'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not resolve nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0.
     Required by:
         :feign-vnderror-spring-cloud-starter:1.2.1-SNAPSHOT
      > Could not resolve nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0.
         > Could not get resource 'https://plugins.gradle.org/m2/nl/javadude/gradle/plugins/license-gradle-plugin/0.11.0/license-gradle-plugin-0.11.0.pom'.
            > Could not HEAD 'https://plugins.gradle.org/m2/nl/javadude/gradle/plugins/license-gradle-plugin/0.11.0/license-gradle-plugin-0.11.0.pom'.
               > The target server failed to respond

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

I’m running it on OS X. Will debug output help in any way?

Build debug:

23:28:06.630 [DEBUG] [org.apache.http.impl.client.SystemDefaultHttpClient] Redirecting to 'https://gradleware-plugins.s3.amazonaws.com/nl.javadude.gradle.plugins/license-gradle-plugin/0.11.0/afded103d53d00171f486ab23c35151d8b82b32e51390c30ae734e83de863c52/license-gradle-plugin-0.11.0.pom' via {s}->https://gradleware-plugins.s3.amazonaws.com
23:28:06.630 [DEBUG] [org.apache.http.impl.conn.PoolingClientConnectionManager]Connection [id: 2][route: {s}->https://plugins.gradle.org] can be kept alive indefinitely
23:28:06.631 [DEBUG] [org.apache.http.impl.conn.PoolingClientConnectionManager]Connection released: [id: 2][route: {s}->https://plugins.gradle.org][total kept alive: 1; route allocated: 1 of 5; total allocated: 1 of 10]
23:28:06.631 [DEBUG] [org.apache.http.impl.conn.PoolingClientConnectionManager]Connection request: [route: {s}->https://gradleware-plugins.s3.amazonaws.com][total kept alive: 1; route allocated: 0 of 5; total allocated: 1 of 10]
23:28:06.631 [DEBUG] [org.apache.http.impl.conn.PoolingClientConnectionManager]Connection leased: [id: 3][route: {s}->https://gradleware-plugins.s3.amazonaws.com][total kept alive: 1; route allocated: 1 of 5; total allocated: 2 of 10]
23:28:07.050 [DEBUG] [org.apache.http.impl.conn.DefaultClientConnectionOperator]                                                                               Connecting to gradleware-plugins.s3.amazonaws.com:443
23:28:08.094 [DEBUG] [org.apache.http.client.protocol.RequestAddCookies] CookieSpec selected: best-match
23:28:08.095 [DEBUG] [org.apache.http.client.protocol.RequestAuthCache] Auth cache not set in the context
23:28:08.095 [DEBUG] [org.apache.http.client.protocol.RequestTargetAuthentication                                                                              ]                                    Target auth state: UNCHALLENGED
23:28:08.095 [DEBUG] [org.apache.http.client.protocol.RequestProxyAuthenticatio]                                                                               Proxy auth state: UNCHALLENGED
23:28:08.096 [DEBUG] [org.apache.http.impl.client.SystemDefaultHttpClient] Attempt 2 to execute request
23:28:08.096 [DEBUG] [org.apache.http.impl.conn.DefaultClientConnection] Sending request: HEAD /nl.javadude.gradle.plugins/license-gradle-plugin/0.11.0/afded103d53d00171f486ab23c35151d8b82b32e51390c30ae734e83de863c52/license-gradle-plugin-0.11.0.pom HTTP/1.1
23:28:31.204 [DEBUG] [org.apache.http.impl.conn.DefaultClientConnection] Connection 0.0.0.0:58525<->54.231.112.176:443 closed
23:28:31.204 [DEBUG] [org.apache.http.impl.client.SystemDefaultHttpClient] Closing the connection.
23:28:31.205 [DEBUG] [org.apache.http.impl.conn.DefaultClientConnection] Connection 0.0.0.0:58525<->54.231.112.176:443 closed
23:28:31.205 [DEBUG] [org.apache.http.impl.conn.DefaultClientConnection] Connection 0.0.0.0:58525<->54.231.112.176:443 shut down
23:28:31.205 [DEBUG] [org.apache.http.impl.conn.DefaultClientConnection] Connection 0.0.0.0:58525<->54.231.112.176:443 closed
23:28:31.206 [DEBUG] [org.apache.http.impl.conn.PoolingClientConnectionManager]Connection released: [id: 3][route: {s}->https://gradleware-plugins.s3.amazonaws.com][total kept alive: 1; route allocated: 0 of 5; total allocated: 1 of 10]
23:28:31.207 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.oldresult.TransientConfigurationResultsBuilder                                ]                                    Flushing resolved configuration data in Binary store in /private/var/folders/hp/cwdc3czj09v6lb9zrk38z3v40000gn/T/gradle1954152603722964896.bin. Wrote root :feign-vnderror-spring-cloud-starter:1.2.1-SNAPSHOT:classpath.
23:28:31.208 [DEBUG] [org.gradle.configuration.project.BuildScriptProcessor] Timing: Running the build script took 26.376 secs
23:28:31.211 [ERROR] [org.gradle.BuildExceptionReporter]
23:28:31.212 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
23:28:31.212 [ERROR] [org.gradle.BuildExceptionReporter]
23:28:31.212 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
23:28:31.212 [ERROR] [org.gradle.BuildExceptionReporter] A problem occurred configuring root project 'feign-vnderror-spring-cloud-starter'.
23:28:31.212 [ERROR] [org.gradle.BuildExceptionReporter] > Could not resolve all dependencies for configuration ':classpath'.
23:28:31.212 [ERROR] [org.gradle.BuildExceptionReporter]    > Could not resolve nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0.
23:28:31.213 [ERROR] [org.gradle.BuildExceptionReporter]      Required by:
23:28:31.213 [ERROR] [org.gradle.BuildExceptionReporter]          :feign-vnderror-spring-cloud-starter:1.2.1-SNAPSHOT
23:28:31.213 [ERROR] [org.gradle.BuildExceptionReporter]       > Could not resolve nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0.
23:28:31.213 [ERROR] [org.gradle.BuildExceptionReporter]          > Could not get resource 'https://plugins.gradle.org/m2/nl/javadude/gradle/plugins/license-gradle-plugin/0.11.0/license-gradle-plugin-0.11.0.pom'.
23:28:31.213 [ERROR] [org.gradle.BuildExceptionReporter]             > Could not HEAD 'https://plugins.gradle.org/m2/nl/javadude/gradle/plugins/license-gradle-plugin/0.11.0/license-gradle-plugin-0.11.0.pom'.
23:28:31.213 [ERROR] [org.gradle.BuildExceptionReporter]                > The target server failed to respond
23:28:31.214 [ERROR] [org.gradle.BuildExceptionReporter]
23:28:31.214 [ERROR] [org.gradle.BuildExceptionReporter] * Try:
23:28:31.214 [ERROR] [org.gradle.BuildExceptionReporter] Run with --stacktrace option to get the stack trace.
23:28:31.214 [LIFECYCLE] [org.gradle.BuildResultLogger]
23:28:31.215 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED
23:28:31.215 [LIFECYCLE] [org.gradle.BuildResultLogger]
23:28:31.215 [LIFECYCLE] [org.gradle.BuildResultLogger] Total time: 27.022 secs

You can try to run with debug logging level. I think there might be some issue with your network or a firewall blocking your request. You could try to just open the URL in the browser and see if that works for you.

As for Gradle 2.7, I think you already downloaded the plugin before. Now Gradle is using it from the cache exclusively.

Well I can download it from the browser:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>nl.javadude.gradle.plugins</groupId>
  <artifactId>license-gradle-plugin</artifactId>
  <version>0.11.0</version>
  <dependencies>

But no luck with the build.

I can push the wrapper to CI server and see if it works there.

Then I can only think of proxy settings. Are you sitting behind a proxy? If yes, did the credentials change recently?

A sorry for false alarm, https://travis-ci.org/jmnarloch/feign-vnderror-spring-cloud-starter the build works fine, except for my personal machine, I haven’t configured explicitly any proxy settings and the only thing that could have changes on my side is system upgrade including Xcode in past days, though it’s hard to tell whether this could affect this in any way.

This is clearly my machine problem, to makes matters worse I’ve clean the Gradle cache for test and now I can not build anything - the problem persists with any other Gradle version. I’m will have to see what can I do with it.

Thank you for your help.

I have found the solution, I had to add

buildscript {
    repositories {
        jcenter()
    }
}

As described in this issue: