gnodet commented on PR #14124:
URL: https://github.com/apache/maven/pull/14124#issuecomment-7187830419

   Looking at the `master`/`4.0.x` code paths, I don't believe those branches 
are affected by the same bug, though they go through a different code path.
   
   On `master`/`4.0.x`, the equivalent concept is `isExternalOrigin()` in 
`maven-impl`'s `DefaultModelBuilder`:
   
   ```java
   static boolean isExternalOrigin(ModelBuilderRequest request) {
       return request.getRequestType() == 
ModelBuilderRequest.RequestType.CONSUMER_DEPENDENCY
               && request.getSource() != null
               && request.getSource().getModelId() != null;
   }
   ```
   
   The key difference is the `source.getModelId() != null` guard. In 
`importDependencyManagement()` on `master`, the code first calls 
`resolveReactorModel()` for the BOM. If the BOM is in the reactor, it returns a 
**file-based source** (a `Path`) — which carries no `modelId`. So 
`isExternalOrigin()` returns `false` for reactor BOMs, and they are correctly 
built without the external-model restrictions. There is even an explicit 
warning logged when a `BUILD_PROJECT` request imports a BOM from within the 
reactor.
   
   On `3.10.x`, the `workspaceResolver` path is supposed to handle reactor BOMs 
(returning the already-built effective model directly, bypassing the 
`importRequest` with `VALIDATION_LEVEL_MINIMAL` entirely). The bug in #12953 is 
that when the workspace resolver doesn't cover the BOM, the fallback 
`modelResolver` path builds the import request with `VALIDATION_LEVEL_MINIMAL` 
and no `pomFile`, which satisfies `isExternalModelBuildingRequest()` even for 
in-reactor artifacts. The `master` code avoids this by using the source type as 
the discriminator rather than the validation level.
   
   So the fix is correctly scoped to `3.10.x` — there's nothing to backport 
from `master`/`4.0.x` since the structural difference in how sources are typed 
prevents the problem from occurring there.
   


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