gnodet opened a new pull request, #13803:
URL: https://github.com/apache/maven/pull/13803

   Backport of #13794 to `maven-3.10.x`.
   
   Cherry-pick of 51bee60175f3648b5932db965c199aafd1cc4ccc — required conflict 
resolution.
   
   **Changes:**
   - `MavenSession.currentProject` is now a plain `ThreadLocal` (no 
`withInitial`), with a separate `defaultProject` field holding the fallback. 
Reading `getCurrentProject()` on a thread that never called 
`setCurrentProject()` returns the default without storing it in the thread's 
map, preventing stale references that kept the project (and the whole build 
graph) alive on long-lived threads (e.g. `ForkJoinPool.commonPool` workers in 
mvnd).
   - `clone()` copies the current project into the clone's `defaultProject` 
instead of creating a new `ThreadLocal.withInitial`.
   - New test 
`MavenSessionTest.testReadingCurrentProjectOnOtherThreadDoesNotRetainProject` 
verifies threads don't retain a strong reference to the project after the 
session is discarded.
   
   **Adaptation for maven-3.10.x:**
   - Module path: `maven-core/` (not `impl/maven-core/`)
   - `setProjects()` default project is `first` (first in reactor order), 
preserving existing `maven-3.10.x` behavior (master uses the execution root)
   - Test uses `Collections.singletonList()` instead of `List.of()` (Java 8 
source level)
   - Test uses 4-arg constructor `MavenSession(container, repoSession, request, 
result)` (no 3-arg constructor on 3.10.x)


-- 
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