Sitelet https://github.com/apache/maven-resolver/pull/2104
Skip to content

Fix: tidy up f013 - #2104

Merged
cstamas merged 5 commits into
apache:masterfrom
cstamas:cnid-hurl
Sep 1, 2026
Merged

cstamas merged 5 commits into
apache:masterfrom
cstamas:cnid-hurl

Conversation

@cstamas

@cstamas cstamas commented Sep 1, 2026 •

Copy link
Copy Markdown
Member

Flip system key instead.

The cnid_hurl is "central normalized" nid_hurl, and for MC
it will keep returning "central" ID as before, making it
compatible across all Maven versions.
@cstamas
cstamas requested a review from gnodet September 1, 2026 07:33
@cstamas cstamas self-assigned this Sep 1, 2026
@cstamas cstamas changed the title Fix: introduce new key function: cnid_hurl Fix: tidy up f013 Sep 1, 2026
@cstamas
cstamas marked this pull request as ready for review September 1, 2026 10:01

@gnodet gnodet 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.

Looks good — clean improvement over the lazy volatile init. Two minor observations, neither blocking:

  1. Stale Javadoc on realBasePath: the comment still says "Lazily computed" but the field is now final and eagerly initialized. Worth a quick update (e.g. "Resolved at construction time").

  2. Unrelated RemoteRepository.java change: the @see fully-qualified fix is harmless but unrelated to the realBasePath improvement — could be a separate commit or dropped to keep the diff focused.

Otherwise: final field, fail-fast at construction, IOException surfacing cleanly through the package-private constructor to the factory — strictly better than the previous pattern. 👍

@cstamas
cstamas merged commit 4f27db9 into apache:master Sep 1, 2026
1 check passed
@cstamas
cstamas deleted the cnid-hurl branch September 1, 2026 10:24
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

@cstamas Please assign appropriate label to PR according to the type of change.

@github-actions github-actions Bot added this to the 2.0.23 milestone Sep 1, 2026
cstamas pushed a commit that referenced this pull request Sep 2, 2026
…2111)

Since #2104 `EnhancedLocalRepositoryManager` resolves the real path of its base directory in the constructor, and `Path.toRealPath()` requires the path to exist.

A local repository that has not been created yet (first build on a machine, or a new `-Dmaven.repo.local`) therefore made the enhanced factory throw `NoLocalRepositoryManagerException`. `DefaultLocalRepositoryProvider` treats that as "try the next factory" and quietly selected `SimpleLocalRepositoryManager`, so the whole first session ran without `_remote.repositories` tracking. Before #2104 the real path was computed lazily, only for files that already existed, so the directory was always present.

The fix creates the directory before resolving it. Maven creates it on first write anyway and the enhanced manager needs it for its tracking files, so nothing observable changes for a usable local repository; an unwritable location still fails the same way it did before.

Two tests cover the factory directly and the provider's fallback selection with a not-yet-existing base directory; both fail on master with the `NoSuchFileException` cause.

*This change was created with AI assistance.*
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.

2 participants