This message was deleted.
# community-support
s
This message was deleted.
e
Copy code
// gradle/libs.versions.toml
[libraries]
group-name = "group:name:version"

// build.gradle
dependencies {
    configurationName(libs.group.name) {
        artifact {
            type = "extension"
        }
    }
}
I believe you mean "extension" rather than "classifier", because that's what "@" does
j
Thanks a lot. I really mean classifier, for example:
Copy code
testImplementation("org.apache.kafka:kafka-clients:3.0.0:test")
Unfortunately this doesn't seem to work. TOML:
Copy code
[versions]
kafka = "2.8.1"

[libraries]
kafka-clients = { module = "org.apache.kafka:kafka-clients", version.ref = "kafka" }
build.gradle
Copy code
api(libs.kafka.clients) {
      artifact {
        classifier = "test"
      }
    }
Error message with Gradle 7.4.1:
Copy code
* What went wrong:
A problem occurred evaluating project ':my-project'.
> Could not resolve all dependencies for configuration ':my-project:runtimeClasspath'.
   > Could not find method artifact() for arguments [build_3bwyqt3y3wr3wnc2ldw9wgwci$_run_closure2$_closure3$_closure6$_closure7@675386e7] on constraint org.apache.kafka:kafka-clients:2.8.1, attributes=null of type org.gradle.api.internal.artifacts.dependencies.DefaultDependencyConstraint.
Ah, wait. I think I misunderstood how to use this in a Java platform (or rather not use it in a Java platform).
t
Note that ideally you wouldn't have to explicitly use classifiers and/or extensions from dependency declarations. Dependency selection should be based on variants, according to variant attributes, and you can use component metadata rules to declare variants on dependencies that lack them. https://docs.gradle.org/current/userguide/component_metadata_rules.html#making_variants_published_as_classified_jars_explicit https://docs.gradle.org/current/userguide/java_testing.html#publishing_test_fixtures