Disable Gradle metadata resolution

I’m having an issue with using Gradle against a Maven Artifactory repository.

When I try to fetch dependencies through an Artifactory virtual repository, Gradle tries to fetch module metadata as .module files. This results in Artifactory looking for .module files in Maven central which don’t exist. Instead of giving back the 404, Artifactory proceeds to look in other places and ends up giving back a 403 error. This prevents the build from continuing.
I’m assuming the normal Gradle behaviour is to ignore not found errors, but not authorisation errors.

Is there a way to totally disable metadata resolution? I can see there’s a way to disable its publication, but I don’t see anything documented for this.

I will go down the route of requesting my organisation to create Gradle specific repositories in Artifactory, but that may not get approved and I’d like to be able to solve this now.

2 Likes

This seems to be possible to achieve via:

repositories {
  maven {
     url '' 
     metadataSources {
                mavenPom()
                artifact()
                ignoreGradleMetadataRedirection()
     }
   }
}