Repository navigation
Fix Maven reactor ${prop} groupId/artifactId (#655) - #1773
Mikola Lysenko (mikolalysenko) merged 3 commits into
Conversation
Assisted-by: Claude Code:claude-opus-5-5
A reactor module that declares the patched library as
<groupId>${ct.group}</groupId> / <artifactId>${ct.artifact}</artifactId>
was skipped by the vendored Maven planner, which compared the raw
element text with the patch coordinates. Maven interpolates those
elements before matching, so the module kept its literal base version
and built Central's unpatched jar while vendor, vendor --check and vex
all reported it patched.
The planner, the external-management check and the revert now match
declarations on interpolated coordinates. A coordinate whose property
is not defined in the checkout gets a property_unresolved warning
instead of passing silently.
Fixes #655
Assisted-by: Claude Code:claude-opus-5-5
Follow-ups from review of the #655 fix: - A module that inherits a ${prop}-named declaration and overrides the property names a different artifact; vendor now leaves the declaration alone and warns coordinates_overridden instead of pointing that module at a version that does not exist. - Declarations matched through properties get their own record-key ordinals, so revert of a project vendored by an older release still finds each literal declaration's original version. - ${project.groupId} and ${project.artifactId} resolve. - The unresolved-coordinate warning respects literal text around the property and skips classifier and non-jar variants, so unrelated dependencies no longer warn. Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 16e930e. Configure here.
|
Ready for review at
Generated by Claude Code |
|
Ready for review at
Generated by Claude Code |
Final review briefWhat it does. Fixes #655: a Maven reactor module that names the patched library through properties ( Risk: medium-low. Product code in the Maven vendoring path, but the change is at one matching boundary and literal declarations behave as before: property-matched declarations get their own record-key section ( Look here
Verified
Changes I made: none. Open questions (non-blocking, for a follow-up if you care): the mirror case isn't warned — a parent declaration whose Auto-merge (squash) is armed, so approving sends it straight to the merge queue. Generated by Claude Code |
LLM Description written by Claude Code:claude-opus-5-5
Fixes #655
Summary
A Maven reactor module that names the patched library through properties
(
<groupId>${ct.group}</groupId>/<artifactId>${ct.artifact}</artifactId>,defined in a local parent) was skipped by
vendor. Its literal<version>1.10.0</version>stayed, which beats the root'sdependencyManagementpin, so that module built Central's unpatched jarwhile
vendorreportedapplied: 1,vendor --checkpassed andvexattested
not_affected.Root cause
Doc::keyed_declarations(vendor/jvm/maven_reactor.rs) compared the rawgroupId/artifactIdtext with the patch coordinates. Maven interpolatesthose elements before matching. Every caller (the rewrite, the
external-management check, and
unplan's version restore) went through it,so the fix is at that boundary: it now takes a resolver, and
Reactorsupplies its existing property lookup for the pom's context.
Changes
management and revert (revert reuses the reactor
unplanalreadydiscovers).
still be the patched GA (literal text around
${...}must fit, jar type,no classifier), gets a
property_unresolveddegraded warning instead ofpassing silently.
${prop}-named declaration and overrides theproperty to name another artifact: the declaration is left alone, with a
coordinates_overriddenwarning and the root unpinned (the same patternas the existing version-override guard).
(
...:<section>:$:<n>), so revert of projects vendored by older releasesstill keys literal declarations as before.
${project.groupId},${project.artifactId}(andpom.*,project.parent.groupId) resolve in the reactor lookup.Tests
Red without the fix, green with it:
maven_reactor::tests::property_coordinates_are_interpolated_and_restored(unit: vendor rewrites, re-plan writes nothing, revert byte-exact)maven_reactor::tests::unresolvable_property_coordinate_warnse2e_vendor_jvm_build::maven_reactor_property_coordinates_vendor_fresh_offline_build_and_revert(real Maven 3.9: fresh checkout, purged ~/.m2,mvn -oresolves the vendored jar inaandb; byte-exact revert)a's version not rewrittenPlus review-driven unit tests:
property_coordinates_keep_literal_record_keys,property_coordinates_another_module_overrides_are_left_alone,project_group_id_coordinate_resolves,unresolvable_coordinate_of_another_artifact_does_not_warn,may_interpolate_to_keeps_literal_text.Commands run locally:
cargo fmt --all -- --check: cleancargo clippy --workspace --all-features -- -D warnings: cleancargo test -p socket-patch-core --lib: 6807 passed. 4 failures arewrite-failure/unremovable-file simulations that can't fail when running as
root in this container (
copy_tree::relax_loop_must_not_traverse_symlinked_root,vlt_heal::an_unremovable_hidden_lock_keeps_every_store_entry,pypi_poetry::wire_write_failure_*,pypi_requirements::wire_failure_*);none touch Maven.
cargo test --workspace --all-features --no-fail-fast: every suitepasses apart from those root-only cases (
in_process_redirect,repair) ande2e_bun_lockb(the known Nightly e2e_bun_lockb red: offline takeover test predates #1648 #1770 breakage on main, fixed inCI: update bun.lockb offline takeover test (#1770) #1771/Fix nightly bun.lockb e2e for the hosted-pin eject #1772).
cargo test -p socket-patch-cli --all-features --test e2e_vendor_jvm_build -- --ignored maven_reactorwith
SOCKET_PATCH_MAVEN_E2E_REQUIRED=1: 2 passed.No wrapper changes needed (
npm/,pypi/,gem/only dispatch to thebinary).
Review (/code-review high) findings not fixed
Reactor::discoverfails (e.g. a nested.mvnaddedafter vendoring): a
${prop}-named declaration isn't matched and keepsthe SV. It's reported as
still references <sv>drift and the tree iskept, so nothing is silent; literal declarations behave as before.
whose property is defined only in a child gets a false
property_unresolvedwarning (degraded, never a wrong rewrite). MatchingMaven exactly needs per-inheritor planning, the same gap the version path
has.
${...}coordinates in external parents and BOMs (jar_declaration)are still literal-only. That's a separate code path (Vendored Maven reactor pins over an imported BOM or external parent, so a build that uses 1.11.0 is silently downgraded to 1.10.0-socket.* and a later BOM bump never takes effect #488 external
management) and a natural follow-up.
declaration whose
${prop}names another artifact in the parent but thepatched one in a child that overrides the property isn't matched, so that
child keeps the parent's literal version without a warning. This isn't a
regression (nothing property-named matched before this PR); it needs the
same per-inheritor planning as the ancestor-context item above.
correctness impact.
https://claude.ai/code/session_011f9aePV9JEJ6eGAd9Um1Ke
Generated by Claude Code