2

I would like to globally disable all transitive dependencies. I am using the following and it works fine.

configurations.all {
    transitive = false
}

Problem is that I need to allow transitive dependencies for one specific dependency. Is there a way to do this?

I tried variations of the following but with no success.

compile("my:dep:xxx") {
    transitive = true
}
ToYonos
  • 16,469
  • 2
  • 54
  • 70
Januson
  • 4,533
  • 34
  • 42

1 Answers1

1

Try that :

configurations.all {
    dependencies.matching { it.group != 'my' || it.name != 'dep' }.all {
        transitive = false
    }
}
ToYonos
  • 16,469
  • 2
  • 54
  • 70