Failed to resolve dependencies with classifiers in maven repo


I’m seeing a strange error.

Artifact 'commons-dbcp:commons-dbcp:1.4:patched@jar' not found.

This artifact uses a “patched” classifier and is a transitive dependency declared in a maven pom. The artifact is installed in a company internal nexus maven repo. The company repo is declared (as a maven repo) in build.gradle.

With debugging on, I can see

Resource missing. [HTTP HEAD:]


Could it be that a correct pom is being found in maven central, and there is an assumption that the artifact will be there too? The artifact is not in maven central and is therefore not being found?

I also tried replacing the dependency:

configurations.all {
 resolutionStrategy.eachDependency { DependencyResolveDetails details ->
  if ( == 'commons-dbcp' && =='commons-dbcp') {
   details.useTarget "commons-dbcp:commons-dbcp:1.4-DBCP330"

This returns:

Artifact 'commons-dbcp:commons-dbcp:1.4-DBCP330:patched@jar' not found.

It looks like its not possible to change the classifier.

You should be able to work around this by specifying a separate artifact repository.

See example 48.28 of

Thanks for that Luke. Is there any way in the resolutionStrategy.eachDependency approach to totally replace a dependency? ie. swap one for another. In the example above it seems the classifier is not being overwritten and ModuleVersionSelector only supports group/name/version.