如何在 Gradle 中使用多个分类器和扩展的给定依赖项?

How do I consume given dependency with multiple classifiers and extensions in Gradle?

我正在尝试弄清楚如何使用 https://repo1.maven.org/maven2/org/sosy-lab/javasmt-solver-z3/4.8.10/ (see also the corresponding entry on mvnrepository.com) as exemplified (with Maven) here 中列出的 *.{so,jar} 文件以及 Gradle 6.8.3 和 Kotlin 配置。我的代码的相关部分是

repositories {
    jcenter()
    mavenCentral()
}

dependencies {
    implementation(group = "org.sosy-lab", name = "javasmt-solver-z3", version = "4.8.10", classifier = "com.microsoft.z3", ext = "jar")
    implementation(group = "org.sosy-lab", name = "javasmt-solver-z3", version = "4.8.10", classifier = "libz3", ext = "so")
    implementation(group = "org.sosy-lab", name = "javasmt-solver-z3", version = "4.8.10", classifier = "libz3java", ext = "so")
}

我得到的输出是

Could not resolve org.sosy-lab:javasmt-solver-z3:4.8.10.

我已经尝试过 (1.) 注释掉三个依赖项中的任意两个,(2.) 重新排序存储库。输出是一样的。我在这里做错了什么?

Gradle 默认搜索 pom.xml 但它失败了,因为一些 JavaSMT 工件没有(或没有有用的)。 但是,您可以告诉 Gradle 直接搜索工件。 为此,您需要像这样将 metadataSource 添加到您的存储库中:

repositories {
    jcenter()
    mavenCentral {
        metadataSources {
            artifact()
        }
    }
}