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

   Implements the suggestion from 
https://github.com/apache/maven/pull/13791#pullrequestreview-5749342049.
   
   ## Problem
   
   When a remote repository filter rejects an artifact, the existing message in 
`DefaultExceptionHandler` always says _"If X **is a project of this build**"_ — 
but `DefaultExceptionHandler` is a `@Singleton` with no access to the 
`MavenSession`, so it cannot actually know whether the artifact is part of the 
reactor. The hint is misleading in the common case where the artifact has 
nothing to do with the build (e.g. the prefix-filter false-positive scenario 
with Nexus/Artifactory group repos).
   
   ## Solution
   
   Move the reactor-aware message to `MavenInvoker.doExecute()`, which has 
session context via `MavenExecutionResult`:
   
   1. **`MavenExecutionResult` / `DefaultMavenExecutionResult`**: add 
`getAllProjects()` / `setAllProjects()` — the full reactor graph (superset of 
the `-pl`-selected projects).
   
   2. **`DefaultMaven`**: set `result.setAllProjects(session.getAllProjects())` 
alongside the existing `setTopologicallySortedProjects`.
   
   3. **`MavenInvoker.doExecute()`**: after each exception, call 
`logFilteredOutHint()` which walks the cause chain for 
`ArtifactFilteredOutException` and emits the precise message:
      - G:A:V in `getAllProjects()` **but not** in 
`getTopologicallySortedProjects()` → _"X is a project of this build but was not 
selected. Add -am …"_
      - G:A:V in both → _"X is part of this build but has not been built yet."_
      - G:A:V in neither → keep the existing repo-manager hint, with artifact 
coordinates.
   
   4. **`DefaultExceptionHandler`**: unchanged — it remains a fallback for 
embedders that do not go through `MavenInvoker`.
   
   ## Testing
   
   New `FilteredOutHintTest` (unit, no network) covering all three branches + 
the no-exception-no-hint case. `maven-core` 821 tests pass.


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