Based on @thoutbeckers, they answer because of a special case where I did not think that his answer was applied, but it really is. Hope this answer can help others who share my problem with a specific case. Initially, I thought that only one dependency in the build.gradle file referred to a bad transitive dependency, but two dependencies actually referred to it. This is due to the fact that in both dependencies, in which a negative transitive dependence was indicated, there were parent / child relations, but I noticed only the relationship with the child dependence, and not the dependence on the parent.
Consider the following dependency tree (created by the gradle <my-project-name>:dependencies command):
compileClasspath - Compile classpath for source set 'main'. +--- my.org:com.my.pkg.parent:6.+ -> 6.0.4 | +---
In the dependency tree, it looks like other.org:bad.transitive:dependency:0.9.1 refers to only one dependency in your assembly file, not two. However, suppose your Gradle file looks like this:
// ... misc. ... dependencies { // ... misc. dependencies ... compile 'my.org:com.my.pkg.parent:6.+' // ... misc. dependencies ... compile ('my.org:com.my.pkg.child:6.0.4') { exclude group: 'other.org', module: 'bad.transitive.dependency' }
For a Gradle file like the one above, the error will persist, although the transitive dependency you wanted to exclude only occurs in the dependencies between the children and not on the parent dependency. However, since both the parent and the child projects reference the build.gradle file, a bad transitive dependency should be excluded from both dependencies, as indicated above.
Note that if you do not want to add an exception at the configuration level (as shown in @thoutbeckers answer), you can always simply exclude the transitive dependency on both dependencies where it is indicated, explicitly.
source share