Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The example build.gradle on https://projects.spring.io/spring-cloud/ doesn't work #87

Open
xak2000 opened this issue Dec 19, 2017 · 0 comments

Comments

@xak2000
Copy link

xak2000 commented Dec 19, 2017

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:

  1. Add
repositories {
	mavenCentral()
}
  1. Add dependency group org.springframework.cloud to 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'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant