Skip to navigation

Gradle Capability Conflicts: Resolve Competing Components With Claude Code

In short: Find why two Gradle components can collide on capability even when their version numbers look unrelated.

Published 21 min read
On this page

Direct answer

A capability conflict is not a version disagreement. Two components declare they provide the same capability, and Gradle refuses to choose between them. The conflict generally fails the build, and Gradle’s conflict documentation describes resolution through resolutionStrategy, which means the fix is a decision about which component wins rather than a version bump. The concrete win is an explicit record of which component owns each capability the build depends on. The concrete loss is that resolving a conflict proves selection, not runtime compatibility; the graph can resolve and the two implementations can still behave differently. The practical implication is that every capability collision needs an inventory of declaring components before anyone picks a winner. Ask Claude Code to list the components and variants that declare the capability, then to propose one explicit resolution for review.

Why a capability collision costs a day

Version bumps do not fix capability conflicts, which is why teams lose time on them. Two artifacts can carry completely unrelated version numbers and still both claim to provide, say, a logging implementation or an annotation processor backend. Raising one version changes nothing about the claim.

The failure surfaces at resolution time, often in CI where the dependency set differs from a developer machine. A local build that never resolves both components hides the conflict, and the first sign of trouble is a red pipeline with an error message naming a capability string rather than a library name. Reading that message as a version problem sends teams down the wrong path for hours.

Evidence and its limits

Official, F025: The Gradle guide on dependency constraints and conflict resolution says capability conflicts generally fail the build and describes manual resolution through resolutionStrategy. The word generally matters; project-specific rules and Gradle versions need review.

Official: The page on component capabilities documents capabilities as identity a component declares and describes declaring and selecting between them.

Official: The variant model describes how a component exposes variants and how consumers select among them, which matters because capabilities can be declared at variant level.

Official: Dependency management basics covers how components, configurations and resolution fit together.

Official, agent loop: Claude Code best practices recommends giving the agent a check that returns pass or fail. For capability work that check is a resolution run after an explicit selection.

Derived, F026: The inventory table and the decision record below are an editorial method. The capabilities page was not full-page fetched in the research pass behind this post, so recheck the exact attribute and DSL names before drafting a real change.

No claim here depends on a Gradle release number, a plugin version, or any benchmark.

What a capability represents

A capability is an identity claim. A component says “I provide this capability” and, optionally, a version for it. Capabilities exist so that alternatives can be expressed: two components that implement the same thing declare the same capability, and the consumer picks one.

The claim can live on the component or on one of its variants. That distinction matters when a component ships several variants where only one provides the capability. A conflict can be caused by a variant entering the graph, not only by a whole component.

Concept What it is Where declared Review question
Component The published module Module metadata Does the whole component claim it?
Variant One consumable face of a component Variant attributes and capabilities Does only one variant claim it?
Capability Identity another component can conflict with Component or variant What is the capability coordinate?
Selection The decision about which claim wins resolutionStrategy Which component loses, and is that intended?

Read the table as a routing rule. Before proposing any fix, name the capability coordinate and every component or variant that claims it.

Find duplicate capability declarations

The error message from a failed resolution names the capability. Start there and work outward.

bash
./gradlew :app:dependencies --configuration runtimeClasspath
bash
./gradlew :app:dependencyInsight --dependency <component-from-error> --configuration runtimeClasspath

The tree shows which paths pulled each competing component in. The insight output for each competitor shows the requests and the selected variant. Two questions to answer from this output. Which build edges brought each competitor in, and which capability string the error named.

A capability conflict can appear without any obvious duplicate when one competitor is transitive. A library your application depends on can carry a component that claims the same capability as a component you declare directly. The inventory below is what makes that visible.

Map components to variants

Once the competitors are named, record who claims the capability and at what level. The map is the artifact that turns an error message into a decision.

Component or variant Declares capability Brought in by Level
com.example:impl-a com.example:logging-api :app direct Component
com.example:impl-b com.example:logging-api Transitive via com.vendor:sdk Component
com.example:impl-a variant runtime none Variant selection Variant

The level column matters for the fix. A variant-level claim can sometimes be avoided by steering variant selection rather than by excluding a whole component. A component-level claim by two separate modules requires an explicit choice.

Treat any entry you cannot fill in from tool output as unknown and say so in the change description. Guessing a level is how a fix that works on one configuration fails on another.

Understand Gradle’s failure behavior

F025 records that capability conflicts generally fail the build. Generally is doing work in that sentence. Project-specific rules, platform constraints and Gradle version differences can all affect whether a collision fails, resolves, or passes unnoticed.

The practical consequence is that a green build is weak evidence. A capability collision that does not fail on your machine may fail on a configuration you do not build locally, or after a dependency update changes which competitor enters the graph. The inventory, not the build result, is the record to keep.

A version bump as the first response is the mistake to avoid. Two components with unrelated versions can both claim one capability, and raising a version does not withdraw either claim. Reach for resolutionStrategy only after the map exists.

Choose an explicit resolution

Three resolution shapes cover the common cases. None of them is universal, and each records a different decision.

Strategy What it records Trade-off Use when
resolutionStrategy.capabilitiesConflictWith One component wins the capability The loser stays in the graph if something else needs it Both components are needed for other reasons
Exclude the losing component on the edge The loser never enters Exclusion is per-edge and can miss paths One path is the only source of the loser
Replace the capability declaration The claim itself changes Requires publishing or a local adjustment You own both components

The first shape is the one Gradle’s conflict documentation describes as manual resolution. Write the selection in build logic the team reviews, not in a developer’s local gradle.properties. A capability decision that lives only on one machine is not a decision, it is a local patch.

Review consumer impact

A capability decision changes what runs, so review it against the consumers that depend on the winner. Three checks keep the review honest.

First, confirm the losing component is not separately required. A capability selection does not remove the losing artifact from the graph if another edge needs it, and a build can end up with both jars on the classpath when the intent was to pick one.

Second, confirm variant selection still matches the consumer. The Gradle variant attributes guide covers how consumer requests select a producer variant, which matters here because a capability can be variant-scoped.

Third, state plainly that resolution is not runtime proof. The graph resolving cleanly does not demonstrate that the two implementations behave the same. Behavior claims need an executed check, not a dependency tree.

Consumer question Evidence to check If it fails
Is the loser still on the classpath? Resolved classpath listing Add an exclusion or reconsider the winner
Which variant was selected? Variant report or insight output Fix the attribute request
Does behavior match? Executed test against the winner Do not claim compatibility from resolution

Document the capability decision

A capability decision is a contract, and contracts belong in the repository. Record four things next to the resolutionStrategy block: the capability coordinate, the winner, the loser, and the reason.

The reason is the part teams skip and later regret. A decision recorded as “impl-a wins” reads six months later as an arbitrary choice. The same decision recorded as “impl-a wins because impl-b is only present via the vendor sdk and we do not use its logging path” can be revisited when the vendor dependency changes.

Ask Claude Code to draft the decision record alongside the fix. The Gradle constraints guide covers the adjacent question of expressing version policy without adding a graph edge, and the same evidence-first habit applies here: paste the resolution output into the change description.

A worked walkthrough of one collision

Suppose an application declares a direct dependency on com.example:impl-a, which advertises the capability com.example:logging-api. A vendor SDK pulled in transitively also ships com.example:impl-b, which advertises the same capability. Configure fails with an error naming logging-api and both components.

The instinctive first move is bumping one version. It changes nothing, because both claims stand regardless of version. The correct sequence starts with the inventory.

Read the failing configuration’s tree and note both components and who brought them in. The application brought impl-a directly. The vendor SDK brought impl-b transitively, and nothing else in the build uses it. That single fact decides the resolution: the team does not need impl-b, so the selection records impl-a as the winner and the change description states that impl-b is present only through the SDK path.

bash
configurations.all {
  resolutionStrategy.capabilitiesConflictWith("com.example:logging-api") {
      prefer("com.example", "impl-a")
  }
}

Run the resolution again and check the resolved classpath for impl-b. A capability selection does not remove the losing artifact if some other edge needs it, so the classpath check is the verification that the decision matches the intent. If impl-b is still present and genuinely unused, an exclusion on the vendor SDK edge is the cleaner follow-up.

Finally, write the decision record next to the block: the capability coordinate, the winner, the loser, and the reason. Six months later, when the vendor SDK updates and changes which component it carries, that reason is the only thing that lets a reviewer re-evaluate the choice instead of re-deriving it.

Anti-patterns that look like fixes

Four patterns recur around capability work, and each one hides a decision a reviewer needs to see.

Pattern What it looks like Why it hurts Do instead
Version bump first Raising one competitor’s version Claims are about identity, not version Inventory before touching versions
Local resolutionStrategy Fix in a developer’s gradle.properties Collision returns on every other machine Put the selection in reviewed build logic
Silent loser Winner recorded, loser not mentioned Reviewers cannot tell what stopped being used Name both, plus the reason
Exclusion everywhere Excluding the loser on many edges Brittle when a new path appears One explicit capability selection

The local fix is the most expensive over time. It works on the machine where it was written and fails in CI, on a teammate’s laptop, and in a release build. A capability decision is a repository decision, and its home is the build logic the team reviews.

None of these is a Gradle defect. They are review hazards, and the inventory plus the classpath check are what catch them.

A runbook for the next capability error

The checklist earlier in this post is the pass condition. The runbook below is the sequence to follow when a capability error arrives.

Reproduce the failure and copy the capability string from the error. The string is the review key, and everything downstream is keyed to it.

Run the resolution task for the failing configuration and record every component and variant that declares the capability, with the level of each claim. Guessing a level is how a fix that works on one configuration fails on another.

Decide the winner and the loser, and write down why. The reason is the part that survives a dependency update. A decision recorded as “impl-a wins” reads later as arbitrary.

Write the selection into build logic the team reviews, never into local properties. Run the resolution again and inspect the resolved classpath for the loser.

State plainly in the change description that resolution is not runtime proof. The graph resolving cleanly does not demonstrate the two implementations behave the same, and a behavior claim needs an executed check.

The runbook takes minutes and produces the two artifacts a reviewer needs: the component inventory and the recorded decision. Skipping it produces a one-line fix that reappears after the next dependency update.

Where this habit pays across the batch

The inventory-first habit in this post is the same one the rest of the batch applies to different constructs. Gradle constraints vs dependencies asks for a resolved-graph diff before a version change, and Gradle variant attributes asks for the consumer request before a notation change. Maven optional dependencies asks for an import scan before a declaration.

The .NET posts apply the same discipline to package versions and generated code. NuGet central package management asks for a props and override inventory before centralizing, and .NET multi-targeting asks for a per-framework build before calling a version supported. C# source generators asks for the generator’s input change before reading its output.

The C++ posts apply it to configure inputs and dependency boundaries. CMake presets asks for the resolved preset inputs before a configure, CMake find_package vs FetchContent asks for a resolution trace before choosing a path, and Conan CMakeDeps asks for the target contract before a layout change.

That consistency is deliberate. The constructs differ, but the shape is the same: read the evidence the tool already produces, then make the smallest change the evidence supports.

The same shape extends to the ecosystems covered in earlier batches. On the Python side, dependency groups versus extras separates local workflow requirements from published optional features, and stub drift audits a package’s declared types against its documented runtime surface. TypedDict boundaries covers separating truly optional keys from missing data before replacing broad dictionary annotations.

On the Go side, module compatibility covers keeping an exported API change inside an import contract, and graph pruning covers why an indirect dependency entry is graph metadata rather than something to delete. Workspace boundaries covers deciding what belongs in go.work versus what stays a module requirement.

On the Rust side, feature unification covers mapping which optional APIs a workspace build actually exposes, and workspace inheritance covers centralizing metadata without hiding crate-local exceptions. Profile boundaries covers separating diagnostic and optimization settings from options that change observable program behavior.

The capability question has a direct analog in Cargo feature unification, where the same “what does this build actually enable” question applies to features rather than components. Both are identity and activation questions, and both reward an inventory before an edit.

Working alongside the review bottleneck

A capability fix with a pasted inventory and classpath check is cheap to review. A fix described as “resolved the conflict” is a reviewer reproducing the work, and reproduction is the expensive part. The Claude Code code review bottleneck covers what happens when generation outpaces the review that has to accept it.

The same reasoning appears in Claude Code cost per verified change, which treats verified work as a separate unit from generated output. A classpath check is a verified unit. A “trust me, the conflict is gone” description is not.

When the review queue is long enough that verification slips, the failure mode is a merge that nobody actually checked. Prevent false success from passing tests covers the case where a green build is the only evidence, and a capability collision is exactly the case where green proves less than it appears to.

The concrete win, loss, and implication

The concrete win is a build where capability ownership is written down. A new contributor reading the resolutionStrategy block and its decision record can tell which component provides each contested capability and why, without re-deriving the collision from an error message.

The concrete loss is the gap between selection and behavior. A resolved graph proves one component was chosen. It does not prove the chosen implementation satisfies the consumer, and it does not prove the losing component’s other functions are unused. That verification is separate work this post does not pretend to automate.

The practical implication is that capability collisions are design decisions with a paper trail, not build errors to silence. Teams that keep a capability inventory resolve the same collision once. Teams that fix each failure as it appears resolve it again after every dependency update.

Capability questions sit next to variant questions. Gradle variant attributes covers how a consumer request selects a producer variant, and Gradle constraints vs dependencies covers version policy without graph edges.

The .NET posts cover the same ownership discipline in a different ecosystem. NuGet central package management covers which central version wins, and .NET multi-targeting covers per-framework package versions. C# source generators covers reviewing a generated contract rather than its output.

For supply-chain questions adjacent to dependency ownership, the Claude Code hallucinated packages guide covers blocking a nonexistent dependency before it reaches the manifest. Install-time behavior is covered separately by the Claude Code dependency install side effects guide.

Review habits sit upstream of every resolution change. Ask what Claude Code verification requires before calling a resolution change done, and Claude Code cost per verified change treats verified work as a separate unit from generated output.

Evidence map showing two components declaring the same capability and Gradle failing the build until an explicit selection names the winner.
Editorial evidence map based on F025 and F026. A capability collision is an identity conflict, not a version conflict; labels are the post author’s.

Checklist before merging a capability fix

Run this list against the diff. Each row is a pass condition.

Check Pass condition If it fails
Capability coordinate Named from the error message Reproduce the failure first
Component inventory Every competitor and its level recorded Complete the map
Winner and loser Both named explicitly Decide before writing the fix
Selection location In reviewed build logic, not local properties Move the decision into the repo
Loser still present Checked against the resolved classpath Add an exclusion or reconsider
Variant selection Consumer request matches the winner Fix attributes
Behavior claim Not made from resolution alone Separate executed check
Workflow from reading the capability error, through the component and variant inventory, to an explicit resolutionStrategy decision and a resolved classpath check.
Editorial workflow derived from F025 and F026. The sequence describes a review routine; it does not replace Gradle’s own resolution rules.

Working with Claude Code on a capability conflict

Give the agent the capability string from the failed resolution and the configuration that failed. Ask for the component and variant inventory before proposing a fix. The agent session works best when the check is a command that returns pass or fail, which is the shape the official best-practices guidance recommends.

Ask the agent to report four things when it finishes. The capability coordinate. The competitors and which level claims each. The winner and loser. The resolved classpath check that shows whether the loser is still present. A report that omits the last item has not finished, because a capability decision that leaves the loser on the classpath may not match the intent.

Reviewing the winner choice is the reviewer’s job. The agent reads metadata and can run resolution, but deciding which implementation should provide a capability is a design decision. The Claude Code verification guide covers the review questions: what changed, what proves it, and what was not checked.

Tradeoff between an explicit capability selection that records ownership and the separate runtime verification that resolution cannot provide.
Editorial tradeoff diagram based on F025 and F026. An explicit selection settles the build; it does not settle runtime behavior.

Data gap and future update

F025 says capability conflicts generally fail the build and points to resolutionStrategy for resolution. The capabilities page behind F026 was not full-page fetched in the research pass, so exact DSL names and attribute names should be rechecked against the current Gradle documentation before a real change. A future update should record, per project, which capabilities are contested and which Gradle version the observations were taken at.

No benchmark, build-time measurement, or runtime compatibility claim is made here. Whether two implementations of one capability behave identically is out of scope and requires executed evidence.

One AI API Key option for OpenAI-format agents

Claude Code uses an Anthropic-format route, so the One AI free model IDs are not a Claude Code model source. The packet records Claude IDs as unavailable on 2026-11-27.

OpenAI-format agents have a separate route: One AI API Key offers https://api.oneaiapikey.com/v1, one key, and 46 live free IDs. It is a different client and request format, not a workaround for Claude Code authentication. Check the free model list and eligibility notes before choosing an agent route, or read the quickstart for the request shape.

FAQ

Why does bumping a version not fix the conflict?

Because a capability conflict is about identity, not version. Two components can carry unrelated version numbers and both claim the same capability. Raising a version does not withdraw either claim, so the collision remains until one component is selected explicitly.

Where should the selection live?

In build logic the team reviews, such as a convention plugin or the module build script. A selection that lives only in a developer’s local properties is a local patch, and the same collision reappears on the next machine or in CI.

Does resolving the conflict prove the two implementations are interchangeable?

No. Resolution proves one component was selected. It does not demonstrate that the winner satisfies the consumer or that the loser’s other behavior is unused. Behavior claims need executed checks.

Can a variant cause a capability conflict on its own?

Yes. Capabilities can be declared at variant level, so a collision can be triggered by one variant entering the graph rather than by a whole component. The inventory should record the level of each claim.

What does “generally fail the build” mean here?

It is Gradle’s own wording in F025. Project-specific rules, platforms and Gradle versions can affect the outcome, so a green build is weak evidence that no capability collision exists in every configuration you ship.

This post is one of ten build-system and dependency guides written together. Gradle Constraints vs Dependencies covers version policy without graph edges, and Gradle Variant Attributes covers consumer-to-producer matching. Maven Optional Dependencies covers keeping transitive expectations explicit.

The .NET posts cover version and generated-code boundaries. NuGet Central Package Management, .NET Multi-Targeting, and C# Source Generators each cover an ownership question of their own.

The C++ posts cover build inputs and dependency boundaries. CMake Presets, CMake find_package vs FetchContent, and Conan CMakeDeps complete the batch.

More from this batch

More Claude Code troubleshooting

Sources

Control checklist covering capability coordinate, component inventory, winner and loser, selection location, and resolved classpath check.
Editorial control checklist derived from F025 and F026. Passing it shows the decision was recorded; it does not prove runtime interchangeability.
Verdict that an inventoried, explicitly selected capability conflict is reviewable, while an unrecorded local selection reappears after every dependency update.
Editorial verdict based on F025 and F026. A recorded capability decision is durable; a local patch is not.
More in Blog

Try it

One API key for GPT, Grok, DeepSeek, Kimi, GLM, MiniMax, Qwen, Step, Beam, Nemotron, ERNIE, Hunyuan, Gemma, Laguna, LFM, LongCat, Llama, Solar, Jais, Mistral, K2 and Roleplay.

One AI API Key speaks the OpenAI and Anthropic formats, so you change the base URL and the key, not your code. Credit packs start at $10, and every model has a published per-token rate.

New accounts$10 credit on sign-up
Claim $10 credit →