Reputation: 2898
I had a Spring Boot application running successfully for a few months. I had been using Spring Boot 1.4.0-BUILD-SNAPSHOT with a few very basic dependencies. Here is how my build.gradle
looked:
buildscript {
ext {
springBootVersion = '1.4.0.BUILD-SNAPSHOT'
}
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'spring-boot'
jar {
baseName = 'test'
version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-actuator')
compile('org.springframework.cloud:spring-cloud-starter-eureka')
compile('org.springframework.cloud:spring-cloud-starter-ribbon')
compile('org.springframework.boot:spring-boot-starter-web')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:Brixton.BUILD-SNAPSHOT"
}
}
eclipse {
classpath {
containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER')
containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8'
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.13'
}
This worked without any problems until 6/11/2016 (yesterday evening). I could run my gradle builds with the command below, and everything worked fine:
$ ./gradlew clean build
However, out of nowhere my gradle builds stopped working with the errors as shown below:
$ ./gradlew build
:compileJava
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all dependencies for configuration ':compileClasspath'.
> Could not resolve org.springframework.boot:spring-boot-starter-actuator:.
Required by:
:test:unspecified
> Failed to resolve imported Maven boms: Cannot change dependencies of configuration 'detachedConfiguration1' after it has been resolved.
> Could not resolve org.springframework.cloud:spring-cloud-starter-eureka:.
Required by:
:test:unspecified
> Failed to resolve imported Maven boms: Cannot change dependencies of configuration 'detachedConfiguration1' after it has been resolved.
> Could not resolve org.springframework.cloud:spring-cloud-starter-ribbon:.
Required by:
:test:unspecified
> Failed to resolve imported Maven boms: Cannot change dependencies of configuration 'detachedConfiguration1' after it has been resolved.
> Could not resolve org.springframework.boot:spring-boot-starter-web:.
Required by:
:test:unspecified
> Failed to resolve imported Maven boms: Cannot change dependencies of configuration 'detachedConfiguration1' after it has been resolved.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 4.846 secs
I tried running ./gradlew dependencies
to see what the dependency errors were. This is what I found:
$ ./gradlew dependencies
... (snipped)
compile - Dependencies for source set 'main'.
Download https://repo.spring.io/snapshot/org/springframework/boot/spring-boot-starter-parent/1.4.0.BUILD-SNAPSHOT/spring-boot-starter-parent-1.4.0.BUILD-20160612.070708-419.pom
Download https://repo.spring.io/snapshot/org/springframework/cloud/spring-cloud-dependencies/Brixton.BUILD-SNAPSHOT/spring-cloud-dependencies-Brixton.BUILD-20160610.161057-28.pom
Download https://repo.spring.io/snapshot/org/springframework/cloud/spring-cloud-dependencies-parent/1.1.2.BUILD-SNAPSHOT/spring-cloud-dependencies-parent-1.1.2.BUILD-20160612.192124-248.pom
Download https://repo.spring.io/snapshot/org/springframework/cloud/spring-cloud-netflix-dependencies/1.1.3.BUILD-SNAPSHOT/spring-cloud-netflix-dependencies-1.1.3.BUILD-20160610.160842-2.pom
+--- org.springframework.boot:spring-boot-starter-actuator: FAILED
+--- org.springframework.cloud:spring-cloud-starter-eureka: FAILED
+--- org.springframework.cloud:spring-cloud-starter-ribbon: FAILED
\--- org.springframework.boot:spring-boot-starter-web: FAILED
compileClasspath - Compile classpath for source set 'main'.
+--- org.springframework.boot:spring-boot-starter-actuator: FAILED
+--- org.springframework.cloud:spring-cloud-starter-eureka: FAILED
+--- org.springframework.cloud:spring-cloud-starter-ribbon: FAILED
\--- org.springframework.boot:spring-boot-starter-web: FAILED
... (same messages repeating for all tasks)
BUILD SUCCESSFUL
Total time: 35.879 secs
After some more investigation, I found out that the dependencies could not be downloaded from repo.spring.io/snapshot
or repo.spring.io/milestone
(I also tried the URLs with http
; same problem). Just to rule out other issues, I also tried with repo.spring.io/release
(with https
and http
) - still exactly the same issue.
To work around this problem, I downgraded the Spring Boot version to 1.3.5.RELEASE (as it was available from Maven Central repository without having to go to Spring's Maven repositories). Here's the updated build.gradle
looks like:
buildscript {
ext {
springBootVersion = '1.3.5.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'spring-boot'
jar {
baseName = 'test'
version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-actuator')
compile('org.springframework.cloud:spring-cloud-starter-eureka')
compile('org.springframework.cloud:spring-cloud-starter-ribbon')
compile('org.springframework.boot:spring-boot-starter-web')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-starter-parent:Brixton.RELEASE"
}
}
eclipse {
classpath {
containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER')
containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8'
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.13'
}
And that worked. Luckily, I wasn't using any of the Spring Boot 1.4.x specific features, so my build went through without any issues. I tested my app and things looked fine. As you can see, I am not using Spring's repositories any more, and all of my dependencies are now getting resolved from mavenCentral()
.
So, my question is, if this is an issue with Spring's Maven Repo, how come it's still an issue (after almost 24 hours), and how come no one seem to be reporting this? I spent hours Googling this, but I cannot seem to find any substantial note or concern about this. And because of that, I am not sure if I am doing something very basic wrong, or I am the discoverer of some kind.
Upvotes: 1
Views: 2246
Reputation: 23
Please try with changing mavenBom dependency as following. We were facing same issues and this works for us.
dependencyManagement {
imports {
mavenBom 'org.springframework.cloud:spring-cloud-dependencies:Brixton.RELEASE'
}
}
Upvotes: 1