Misleading dependency tree when exclude module

gradle-3417
issue-acknowledged

(Davor Sauer) #1

When I’m using this simple gradle build

apply plugin: 'java'

repositories {  mavenCentral() }

dependencies {
    compile ("org.springframework.boot:spring-boot-starter-web:1.3.3.RELEASE") {
        exclude group: "org.springframework.boot", module: "spring-boot-starter-tomcat"
    }

    // A
    compile ("org.springframework.boot:spring-boot-starter-hateoas:1.3.3.RELEASE")
    
    // B
    // compile ("org.springframework.boot:spring-boot-starter-hateoas") {
    //     exclude group: "org.springframework.boot", module: "spring-boot-starter-web"
    // }
}

Then I’m getting dependency tree in which is visible that ‘spring-boot-starter-web’ is pulling ‘spring-boot-starter-tomcat’ but that module is excluded.
Real reason why is there because dependency spring-boot-starter-hateoas is pulling ‘spring-boot-starter-web’. And option A is not excluding that dependency as option B.

With this configuration (option A) is hard to determine which main dependency is pulling spring-boot-starter-tomcat, because this dependency is not listed as transitive dependency of ‘spring-boot-starter-hateoas’

\--- org.springframework.boot:spring-boot-starter-hateoas:1.3.3.RELEASE
     +--- org.springframework.boot:spring-boot-starter-web:1.3.3.RELEASE (*)
     +--- org.springframework.hateoas:spring-hateoas:0.19.0.RELEASE

Maybe this is not a bug, but it can be a missing feature, and misleading one.


(René Groeschke) #2

Hey Davor,

Thanks for the report. I’ve raised GRADLE-3417 to track this issue.