Remove transitive dependency with classifier and replace with new one without classifier


(Tomáš Procházka) #1

Many of our internal libraries using dependency with classifier, something like
’com.x:artifact:1.0.0:classifier’ and now we get rid of the classifier in the new version.
But now i need to force gradle to ignore all the transitive dependencies and add just
’com.x:artifact:2.0.0’

I’m able to remove the dependency globally by

configurations {
all*.exclude group: “com.x”, module: “artifact”
}

But then I can’t add it back. So I need to remove just transition, not direct dependencies.

I tried resolutionStrategy with force and it also doesn’t work.


(Tomáš Procházka) #2

I tried to use also this:

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        if (details.requested.name == 'artifact') {
            details.useTarget group: details.requested.group, name: details.requested.name, version: "3.0.0"                details.because "We want to use version 3.0.0 without classfier"
        }
    }
}

And it also doesn’t help, it looking for the new version, but still with classifier.


(Tomáš Procházka) #3
configurations.all {
    exclude module: "artifact"
    resolutionStrategy.force "com.x:artifact:3.0.0"
}

also doesn’t help, exclude is still more strong than force and dependency is completely missing.


(Tomáš Procházka) #4

Really no way how to replace one dependency by the same one just without classifier?