Skip to content

Conversation

@gnodet
Copy link
Contributor

@gnodet gnodet commented Oct 10, 2025

Backport

This will backport the following commits from master to maven-4.0.x:

Questions ?

Please refer to the Backport tool documentation

…handling (apache#11238)

This change introduces a new RepositoryAwareRequest interface that consolidates
repository handling across multiple Maven service request types, addressing
issues with duplicate repositories being passed to resolvers.

Key changes:

* Add RepositoryAwareRequest interface with repository validation:
  - Provides getRepositories() method and validate() logic
  - Prevents duplicate repositories and null entries
  - Consolidates common repository functionality

* Refactor service request interfaces to extend RepositoryAwareRequest:
  - ArtifactResolverRequest, DependencyResolverRequest, ModelBuilderRequest
  - ProjectBuilderRequest, VersionRangeResolverRequest, VersionResolverRequest
  - Apply repository validation in all implementations

* Fix repository leakage in DefaultProjectBuilder:
  - Store project-specific repositories in BuildSession
  - Implement proper repository merging based on strategy
  - Prevent cross-contamination between sibling projects

* Update resolvers to use toResolvingRepositories() for consistent handling

* Add RepositoryLeakageTest to verify proper isolation between projects

This eliminates duplicate repositories being sent to resolvers and ensures
consistent repository handling across all Maven service requests.

(cherry picked from commit f634360)
@gnodet gnodet added bug Something isn't working backport mvn40 labels Oct 10, 2025
@gnodet gnodet merged commit 58cd69a into apache:maven-4.0.x Oct 10, 2025
19 checks passed
@github-actions github-actions bot added this to the 4.0.0 milestone Oct 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport bug Something isn't working mvn40

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants