Hi,
I have a project A whose compilation leads to 2 JARS :
- A jar without classifier
- A jar with the classifier API containing only tha API classes
On my project B, I use the java feature for defining variant according sourceset (as described on https://docs.gradle.org/current/userguide/feature_variants.html#sec:feature_variant_source_set)
Feature associated with a capability
in dependencies.gradle, I define
dependencies { [sourceSet]Api [GAV of A, classifier API] [sourceSet]Implementation [GAV of A] }
This project B artifact is published on Maven Artifactory server.
On the .module file published, I can clearly see both dependencies for runtime variant
"variants": [ { "name": "cmatsRuntimeElements", "attributes": { "org.gradle.category": "library", "org.gradle.dependency.bundling": "external", "org.gradle.jvm.version": 8, "org.gradle.libraryelements": "jar", "org.gradle.usage": "java-runtime" }, "dependencies": [ { "group": "group", "module": "module", "version": { "requires": "version" }, "thirdPartyCompatibility": { "artifactSelector": { "name": "module", "type": "jar", "extension": "jar", "classifier": "api" } } }, { "group": "group", "module": "module", "version": { "requires": "version" } }, "capabilities": [ { "group": "program", "name": "pgrm", "version": "2.4.1.R1.001" } ]
On a project C, I define a dependency on this variant with
dependencies { implementation ("group:module:version") { capabilities { requireCapability("program:pgrm:2.4.1.R1.001") } } }
In the runtimeClasspath dependency resolution, I expected to have both A.jar and A-api.jar but I only have A-api.jar. Why ? Is something wrong in my configuration ?