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

Conflict when using shadow together with spring-boot-gradle-plugin #5564

Closed
paulvi opened this issue Apr 4, 2016 · 1 comment
Closed

Conflict when using shadow together with spring-boot-gradle-plugin #5564

paulvi opened this issue Apr 4, 2016 · 1 comment
Labels
status: invalid An issue that we don't feel is valid

Comments

@paulvi
Copy link

paulvi commented Apr 4, 2016

in https://github.com/szjug/monolith project

D:\Workspaces\GitHub\monolith>gradle :shadow:shadowJar

FAILURE: Build failed with an exception.

* What went wrong:          
Could not resolve all dependencies for configuration ':shadow:runtime'.
> Could not find org.springframework.boot:spring-boot-starter-data-mongodb:.
  Searched in the following locations:
      https://jcenter.bintray.com/org/springframework/boot/spring-boot-starter-data-mongodb//spring-boot-starter-data-mongodb-.pom
      https://jcenter.bintray.com/org/springframework/boot/spring-boot-starter-data-mongodb//spring-boot-starter-data-mongodb-.jar
  Required by:              
      monolith:shadow:1.0 > monolith:io.github.szjug.greeting:1.0
      monolith:shadow:1.0 > monolith:io.github.szjug.who:1.0
> Could not find org.springframework.boot:spring-boot-starter-web:.
  Searched in the following locations:
      https://jcenter.bintray.com/org/springframework/boot/spring-boot-starter-web//spring-boot-starter-web-.pom
      https://jcenter.bintray.com/org/springframework/boot/spring-boot-starter-web//spring-boot-starter-web-.jar
  Required by:              
      monolith:shadow:1.0 > monolith:io.github.szjug.greeting:1.0
      monolith:shadow:1.0 > monolith:io.github.szjug.who:1.0

* 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: 10.006 secs     

notice that version is empty

ref johnrengelman/shadow#199

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 4, 2016
@wilkinsona
Copy link
Member

Your greeting and who projects are relying on Spring Boot's dependency management to provide the versions for their dependencies. Unfortunately, due an apparent limitation in the way that Gradle works, that same dependency management isn't automatically applied to those dependencies when they're pulled in via a project dependency. This means that they end up without a version and dependency resolution fails. You may want to take this up with the Gradle team. It makes sense to me that, at least by default, the versions of the dependencies determined by the configuration of greeting and who would be used when those dependencies come in transitively via a project dependency.

In the meantime, you can work around the problem by configuring your shadow project to apply the Spring Boot plugin but with repackaging disabled (so you only use its dependency management):

diff --git a/shadow/build.gradle b/shadow/build.gradle
index cd05f50..f987b3d 100644
--- a/shadow/build.gradle
+++ b/shadow/build.gradle
@@ -13,13 +13,16 @@ buildscript {
        */
   dependencies {
     classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3'
-    //classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
+    classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
     classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.3.RELEASE")
   }
 }

 apply plugin: 'java' // or 'groovy'. Must be explicitly applied
 apply plugin: 'com.github.johnrengelman.shadow'
+apply plugin: 'spring-boot'
+
+bootRepackage.enabled = false

 dependencies {
        compile project(':io.github.szjug.greeting')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

3 participants