The example build.gradle on https://projects.spring.io/spring-cloud/ doesn't work
I don't know if this repo is good place for this issue but can't find a better place. Feel free to point me to right repo if this is wrong one.
The build.gradle example from https://projects.spring.io/spring-cloud/ doesn't work at all.
If I select Finchley.M4 version, copy provided build.gradle into clipboard, paste it, then do gradle build, the build fails with:
Could not find org.springframework.boot:spring-boot-gradle-plugin:2.0.0.M6.
If I select Edgware (GA) version, copy provided build.gradle into clipboard, paste it, then do gradle build, the build fails with:
> gradle build
> Configure project :
The plugin id 'spring-boot' is deprecated. Please use 'org.springframework.boot' instead.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':bootRepackage'.
> Could not resolve all dependencies for configuration ':runtime'.
> Cannot resolve external dependency :spring-cloud-starter-config: because no repositories are defined.
Required by:
project :
> Cannot resolve external dependency :spring-cloud-starter-eureka: because no repositories are defined.
Required by:
project :
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
3 actionable tasks: 3 executed
Also please note that spring-boot plugin is deprecated, the new plugin name is org.springframework.boot.
For Edgware (based on spring-boot 1.5.9) the fix is:
- Add
repositories {
mavenCentral()
}
- Add dependency group
org.springframework.cloudto both
dependencyManagement {
imports {
mavenBom 'org.springframework.cloud:spring-cloud-dependencies:Edgware.RELEASE'
}
}
and
dependencies {
compile 'org.springframework.cloud:spring-cloud-starter-config'
compile 'org.springframework.cloud:spring-cloud-starter-eureka'
}
Without this gradle cannot resolve dependencies.
Maybe the trick with skipping dependency group only works since spring-boot 2.0?
Current not working build.gradle for Edgware from https://projects.spring.io/spring-cloud/
buildscript {
ext {
springBootVersion = '1.5.9.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'spring-boot'
dependencyManagement {
imports {
mavenBom ':spring-cloud-dependencies:Edgware.RELEASE'
}
}
dependencies {
compile ':spring-cloud-starter-config'
compile ':spring-cloud-starter-eureka'
}