Home > Software engineering >  Moving transitive dependency from implementation to testImplementation
Moving transitive dependency from implementation to testImplementation

Time:10-14

I have few dependencies, that have the same transitive dependency for tests, resulting in test dependencies ending up in my 'implementation'.

Can I somehow smoothly redirect said dependency to 'testImplementation' or do I have to perform something like:

implementation(A){exclude T}
implementation(B){exclude T}
implementation(C){exclude T}
testImplementation(T)

CodePudding user response:

Something a bit better would be:

configurations {
  implementation {
    exclude(T)
  }
}
testImplementation(T)

Then you won't need to explicitly exclude T for each implementation dependency that might pull it in.

  • Related