@groovy.transform.CompileStatic final class CliPublishingSupport extends java.lang.Object
Publication support for projects whose variants depend on a cli companion artifact declared
with a capability (project(':other') { capabilities { requireCapability('g:other-cli') }}).
Inside a build (or composite) Gradle resolves such a dependency against the owning project's
cli feature variant. In published metadata, however, the capability request must not
survive: the companion is published under its own coordinate (<artifactId>-cli) and the
owner's Gradle Module Metadata only points at it through capability-gated available-at
redirects. A consumer resolving the owner with a capability request from a Maven repository
selects the owner's cli variant and its redirect target — two nodes providing the same
capability — and resolution fails with a capability self-conflict. Published metadata must
therefore record the plain companion coordinate, never the capability request.
| Type Params | Return Type | Name and description |
|---|---|---|
|
static void |
configureDependencyMapping(Project project, ConfigurationVariantDetails details, Configuration resolutionSource)Publish resolved variant-level coordinates for the given variant so a dependency on another project's cli tier (declared with a capability inside the build) lands in the pom as the -cli coordinate rather than the primary one, which Maven consumers could not follow. |
|
static void |
publishCliDependenciesAsCompanionCoordinates(Project project)Configures a library that consumes a cli tier in its main variants (e.g. |
|
static void |
rewritePublishedCliCapabilityDependencies(Project project)Rewrites the generated Gradle Module Metadata of every publication in the project so a dependency declared with a cli-companion capability request ( module + requireCapability('<group>:<module>-cli')) is published as a plain
dependency on the companion coordinate (<group>:<module>-cli). |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |
Publish resolved variant-level coordinates for the given variant so a dependency on another
project's cli tier (declared with a capability inside the build) lands in the pom as the
-cli coordinate rather than the primary one, which Maven consumers could not follow.
Dependency mapping has not been promoted to Gradle's public API yet — it is only reachable
via ConfigurationVariantDetailsInternal; fall back silently when the internal
contract changes. Revisit when https://github.com/gradle/gradle/issues/26163 stabilizes.
Configures a library that consumes a cli tier in its main variants (e.g.
api project(':grails-core') { capabilities { requireCapability('org.apache.grails:grails-core-cli') }})
so its published pom and Gradle Module Metadata record the companion coordinate
(grails-core-cli) instead of the capability request.
Rewrites the generated Gradle Module Metadata of every publication in the project so a
dependency declared with a cli-companion capability request
(module + requireCapability('<group>:<module>-cli')) is published as a plain
dependency on the companion coordinate (<group>:<module>-cli). Dependency mapping
(publishResolvedCoordinates) already does this for the pom, but Gradle preserves
the capability request in the module metadata, which consumers cannot resolve against the
published component tree. Registration is idempotent per project.