Skip to content

Drop the maven-compat test dependency - #1679

Merged
slachiewicz merged 1 commit into
masterfrom
agent/mdep-drop-maven-compat
Aug 10, 2026
Merged

slachiewicz merged 1 commit into
masterfrom
agent/mdep-drop-maven-compat

Conversation

@slachiewicz

@slachiewicz slachiewicz commented Aug 9, 2026 •

Copy link
Copy Markdown
Member

Last piece of the three-part split of the original #1677. Now that #1677 has merged, this is rebased onto master and is a single commit.

Nothing needs LegacyRepositorySystem any more: dependency:get stopped using the legacy org.apache.maven.repository.RepositorySystem in #1677, and that interface's only implementation is the one maven-compat supplies.

I checked the dependency direction rather than assuming it. With maven-compat removed from the pom and the vendored class in place, but GetMojo unchanged, TestCopyDependenciesMojo2 passed 13/13 while all four TestGetMojo tests failed to provision the mojo — which is why this had to wait for #1677 rather than going first.

The one judgement call

SnapshotArtifactRepositoryMetadata is copied into the test tree rather than deleting its two usages. TestCopyDependenciesMojo2.assertArtifactExists iterates artifact.getMetadataList() and asserts a file exists — dropping the attachment leaves that loop empty and silently removes the check, which is worse than vendoring.

The split is upstream's own: AbstractRepositoryMetadata, RepositoryMetadata and ArtifactRepositoryMetadata are all in maven-core 3.9.x, and only this leaf lives in maven-compat — the same situation as MPLUGIN-384. The copy matches maven-compat 3.9.16 method for method.

The non-vendoring alternative, maven-core's ArtifactRepositoryMetadata, is artifact-level metadata (storedInArtifactVersionDirectory() is false), so it would move the asserted maven-metadata path out of the snapshot version directory and weaken the assertion. Happy to go that way instead if the preference is to keep copied classes out of the test tree.

422 unit tests pass.

Drafted with Claude — please verify

@slachiewicz
slachiewicz force-pushed the agent/mdep-drop-maven-compat branch from 1409b87 to 3516257 Compare August 9, 2026 19:54
@slachiewicz
slachiewicz force-pushed the agent/mdep-get-test-hardening branch from 46046e7 to 192310d Compare August 9, 2026 19:56
@slachiewicz
slachiewicz force-pushed the agent/mdep-drop-maven-compat branch from 3516257 to 3815fa0 Compare August 9, 2026 19:58
Base automatically changed from agent/mdep-get-test-hardening to master August 9, 2026 20:21
@slachiewicz
slachiewicz force-pushed the agent/mdep-drop-maven-compat branch from 3815fa0 to 3196c18 Compare August 9, 2026 20:28
@slachiewicz
slachiewicz marked this pull request as ready for review August 9, 2026 23:15
Nothing needs LegacyRepositorySystem any more: the get goal stopped using
org.apache.maven.repository.RepositorySystem in the previous commit, and that
interface's only implementation is the one maven-compat supplies.

The one other thing the plugin took from maven-compat is
SnapshotArtifactRepositoryMetadata, copied here into the test tree rather than
deleting its two usages. TestCopyDependenciesMojo2.assertArtifactExists
iterates artifact.getMetadataList() and asserts a file exists, so dropping the
attachment would leave that loop empty and silently remove the check. The whole
hierarchy above the class is in maven-core and only the leaf is compat-only.
Same approach as MPLUGIN-384.

Generated-by: Claude Opus 5 (1M context)
@slachiewicz
slachiewicz force-pushed the agent/mdep-drop-maven-compat branch from 3196c18 to e3981ab Compare August 10, 2026 00:06
@slachiewicz
slachiewicz merged commit 933c220 into master Aug 10, 2026
20 of 21 checks passed
@slachiewicz
slachiewicz deleted the agent/mdep-drop-maven-compat branch August 10, 2026 00:51
@github-actions github-actions Bot added this to the 3.11.1 milestone Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant