0

I have three Gradle modules: ModA and ModB and ModC

ModA has a dependency on ModB AND Spring Web MVC 3.2.6

ModB has a dependency on ModC

ModC has a dependency on Spring Web MVC 4.1.5

I'm getting quite a few errors because ModA is pulling in and using Spring 4.1.5 instead of 3.2.6. Because of version differences and time I can't update ModA to Spring 4.1.5 right now. What I'd like to do is exclude Spring 4.1.5 from the ModB dependency in the ModA Gradle file, so that only 3.2.6 is pulled in and used; however, everything I've tried hasn't excluded the dependency.

DOESNT WORK: ModA build.gradle:

compile('com.stuff:ModB:+') {
        exclude group: 'org.springframework'
    }

compile('com.stuff:ModB:+') {
        exclude group: 'org.springframework', module: 'spring-webmvc'
    }

So, how can I exclude a module from a dependency's dependency? And if this is how I'm supposed to, why might it not be working?

BartoszKP
  • 34,786
  • 15
  • 102
  • 130
philhan
  • 590
  • 1
  • 6
  • 19

1 Answers1

0

you can put transitive false as default, and add to your dependencies the module of your interest. As i see you are using the right way to exclude only one dependency, try to add the specific revision that you are interest to not fetch.

mautrok
  • 961
  • 1
  • 17
  • 41