gnodet commented on issue #8494:
URL: https://github.com/apache/maven/issues/8494#issuecomment-4110341649

   This issue is **fixed in Maven 4**.
   
   I verified both test scenarios from the integration test 
(`MavenITmng6772NestedImportScopeRepositoryOverride`) by running them manually 
against Maven 4.1.0-SNAPSHOT:
   
   **Scenario 1** (`testitInProject`): Project overrides `central` repo, 
imports POM `a` which imports POM `b` — all artifacts only available from the 
overridden repo → **BUILD SUCCESS**
   
   **Scenario 2** (`testitInDependency`): Same pattern but through dependency 
resolution → **BUILD SUCCESS**
   
   The fix is architectural. Maven 4's `DefaultModelBuilder` no longer uses the 
old `DefaultModelResolver` with `repositoryIds` tracking that caused the bug. 
Instead:
   
   1. **Session-based repository propagation**: The `Session` object carries 
the full repository configuration, including user-overridden repos
   2. **Repository aggregation**: `RepositoryFactory.aggregate()` properly 
merges repositories, respecting user overrides of the `central` ID
   3. **Import scope resolution**: When processing import-scoped dependencies, 
the repositories from the parent request (including the overridden central) are 
explicitly passed via `ModelBuilderRequest.builder().repositories(repositories)`
   
   The integration test `MavenITmng6772NestedImportScopeRepositoryOverride` 
should be re-enabled (removing `@Disabled`) now that the issue is resolved.
   
   Related: #7816 (MNG-5781) is the same root cause and is also fixed.
   
   _Claude Code on behalf of Guillaume Nodet_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to