Opt out of gradle module metadata for a specific dependency?

This question is in regards to the following issue: https://bz.apache.org/bugzilla/show_bug.cgi?id=64465

JMeter version 5.2.1 and beyond includes an invalid artifact ‘org.apache.jmeter:bom’ in the Gradle metadata file, which can cause Gradle to fail with the following error when a dependency on JMeter is present:
Could not find org.apache.jmeter:bom:5.2.1

Gradle 6.0 publishes Gradle module metadata by default (https://blog.gradle.org/gradle-metadata-1.0). Since the JMeter project was upgraded to Gradle 6 (https://github.com/apache/jmeter/commit/6ef7d17fc345117dc61fcaa8603a3c71efd6fed3), Gradle module metadata has been published in addition to the Maven POM, which can be seen at https://repo1.maven.org/maven2/org/apache/jmeter/ApacheJMeter_core/5.2.1/

I understand that ultimately, this should be fixed on the Jmeter side, but I am wondering if there is any way for me at the consumer-side to opt out of using the gradle module meta-data and fall back to the regular pom.xml?

Thanks,
Daniel

It’s a bit hacky, but you could use another project to customise the repository

project(':hack') {
    repositories {
      maven {
         url 'http://path/to/maven/repo'
         metadataSources {
            mavenPom()
         }
      }
    }
    configurations { jmeter }
    dependencies {
        jmeter 'org.apache.jmeter:ApacheJMeter_java:5.3'
    }
}
project(':consumer') {
   repositories { ... }
   dependencies {
      compile project(path: ':hack', configuration, 'jmeter')
      compile 'some.normal:dependency:1.0'
   }
}

See MetadataSources

Awesome! I am getting closer.
Actually, this is what i needed:

metadataSources {
                mavenPom()
                ignoreGradleMetadataRedirection()
            }

For my particular setup it also only worked when configuring the repositories of all subprojects this way. I did not look into it in detail, but that and ignoreGradleMetadataRedirection() made it work.