Handle Gradle metadata pom-only artifacts#1575
Draft
shs96c wants to merge 2 commits into
Draft
Conversation
Replace the `Map<Coordinates, Path>` side-channel on `ResolutionResult` with a `Map<Coordinates, ResolvedArtifact>` that has an entry for every node in the resolved graph. Each `ResolvedArtifact` holds its coordinates and an optional path, so "this node has no known binary" is represented explicitly rather than inferred from an absent map entry. This is a pure refactoring: the Maven and Gradle resolvers populate the new shape from exactly the information they already had, the downloader still receives the same set of known paths, and the lock file, its format, and the resolved-artifact hashes are all unchanged. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
A Gradle Module Metadata "umbrella" coordinate (and likewise a `<packaging>pom</packaging>` aggregator or an `available-at` redirect) publishes a POM but no binary of its own. The Gradle resolver's path fallback used to associate such a node's POM with it as if the POM were the module's JAR, so the downloader hashed the POM in the JAR's place and the lock file recorded a bogus artifact hash. Decide "no binary" upstream in the resolver instead: a node whose only file is a POM is recorded as an aggregator on its ResolvedArtifact, and any stale POM path is dropped so it is never handed to the downloader. The downloader honours the explicit aggregator signal by returning a binary-less result -- keeping the POM's repositories so the lock file can still locate the coordinate -- rather than throwing UriNotFoundException. An empty path alone cannot carry this meaning because Maven reports empty paths for everything it still has to fetch, so the signal must be explicit. Builds on "refactor: carry a ResolvedArtifact for every resolution node". Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
shs96c
force-pushed
the
shs/gradle-gmm-pom-only-artifacts
branch
from
June 9, 2026 15:26
afcd86b to
8cfae04
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Generated by my AI agent.
Why
Gradle metadata can resolve a component as a metadata wrapper without a binary artifact for that coordinate. The resolver should not hash a POM as that binary, and lockfile materialization should not emit deps to targets that were never resolved.
What
Risk Assessment
Medium — this changes Gradle resolver lockfile handling for unusual metadata-only or platform-specific artifacts, but the behavior is covered by focused tests and only removes invalid target edges.
References
bazel test --java_runtime_version=remotejdk_17 //tests/com/github/bazelbuild/rules_jvm_external/resolver/gradle:GradleResolverTest //tests/com/github/bazelbuild/rules_jvm_external/resolver/maven:DownloaderTest //tests/com/github/bazelbuild/rules_jvm_external/resolver/lockfile:V3LockFileTest //tests/unit:v3_lock_file_tests_test_0 //tests/unit:v3_lock_file_tests_test_1Generated with Codex