简体   繁体   中英

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

I am trying to figure out how to consume the *.{so,jar} files listed in 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 , with Gradle 6.8.3 and a Kotlin configuration. Relevant parts of my code are

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")
}

The output I get is

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

I already tried (1.) commenting out any two out of the three dependencies, (2.) reordering the repositories. The output is the same. What am I doing wrong here?

Gradle searches for a pom.xml per default and it fails because some of the JavaSMT artifacts don't have any (or no useful ones). You can however tell Gradle to search for artifacts directly. To do this you need to add a metadataSource to your repo like so:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM