Skip to content

Chore: use ApiRunner repositories in mvnval - #13648

Merged
gnodet merged 3 commits into
apache:masterfrom
ikxeno:chore/mvnval-provider-workaround
Oct 30, 2026
Merged

gnodet merged 3 commits into
apache:masterfrom
ikxeno:chore/mvnval-provider-workaround

Conversation

@ikxeno

@ikxeno ikxeno commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Targets Maven 4.1.0 (master).

After #13471, mvnval can use ApiRunner's remote repositories directly.

An unqualified Session lookup could previously select mvnup's named provider, which supplies its own repositories. mvnval worked around this by rebuilding the repository list from settings.

Remove that duplicate conversion and Central fallback. Keep the local repository override so --local-repository still takes precedence over settings.xml.

After apache#13469, mvnval can use ApiRunner's remote repositories directly.
Remove the duplicate settings conversion and Central fallback.

Keep the CLI local repository override ahead of settings.xml and test
both default and configured remote repositories.

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean removal of duplicated repository-derivation logic. ApiRunner.createSession() already reads repositories from settings.xml via SettingsBuilder.convert() and calls session.withRemoteRepositories() (lines 647-657), making ValidateInvoker.derivedRepositories() redundant. The new parameterized test correctly validates that the CLI local repository overrides settings.xml and that remote repositories are derived from settings. @ResourceLock(SYSTEM_PROPERTIES) with try/finally is correctly applied.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean removal of a workaround made redundant by #13471. ApiRunner.newSession() already derives remote repositories from settings (including the Central fallback with snapshots disabled), so the deleted derivedRepositories() method was purely redundant — a good cleanup.

One minor observation on the new test:

This review was generated by an AI agent, Hermès on behalf of @gnodet.

Name the test after its settings-or-Central behavior and local repository
override. Both parameterized cases guard the session contract.

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following up on my earlier review — the naming/intent concern I raised about shouldUseStandaloneRepositories has been fully addressed.

The new shouldUseSettingsRepositoriesOrCentralWithRequestedLocalRepository parameterized test directly validates what this PR claims: (1) the CLI-requested local repository overrides settings.xml, and (2) remote repositories come from settings (or fall back to Central when none are declared). This is a genuine integration test that exercises ApiRunner.createSession() directly — far more useful than the previous stub-based test.

Code analysis confirms the simplification is correct: ApiRunner.newSession() already calls withRemoteRepositories(settingsRepos) where settingsRepos is derived from SettingsBuilder (which adds the Central fallback when no repositories are declared). The old derivedRepositories() method was re-implementing the exact same logic, making it purely redundant.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@ikxeno
ikxeno requested a review from gnodet October 23, 2026 14:47
@gnodet
gnodet merged commit 37445d2 into apache:master Oct 30, 2026
22 checks passed
@github-actions github-actions Bot added this to the 4.2.0 milestone Oct 30, 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.

3 participants