How to eliminate dependency from compilation, but not from testCompile

I have a transitive compilation dependency on the old testX library. The testX library should not be compilation dependent, but testCompile. What else would I like to depend on the new version of testX, and not on the old one.

I have a partial solution that installs the correct version of the library, but it works by overriding the compilation dependency. But I was left with unwanted textX in compilation.

compile group: 'x', name: 'testX', version 'new'

I tried to exclude the testX library from compilation and add an explicit testCompile dependency, but the exception also removes the testCompile dependencies.

testCompile group: 'x', name: 'testX', version 'new'

configurations {
    compile.exclude group: 'x', module: 'X'
}
+4
source share
1 answer

, . , :

configurations.all {
  resolutionStrategy {
    force 'x:testX:1.1.1'
  }
}
0

Source: https://habr.com/ru/post/1538582/


All Articles