slachiewicz opened a new issue, #13395:
URL: https://github.com/apache/maven/issues/13395

   In the Maven 3 compatibility layer (the v3 bridge), `DefaultProjectBuilder` 
picks the Maven 4 request type for `build(File, ProjectBuildingRequest)` like 
this 
([impl/maven-core/.../DefaultProjectBuilder.java:468-478](https://github.com/apache/maven/blob/master/impl/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java#L468-L478)):
   
   ```java
   reactorMember || isStandalone
           || (pomFile != null && request.isProcessPlugins()
                   && request.getValidationLevel() == 
ModelBuildingRequest.VALIDATION_LEVEL_STRICT)
       ? BUILD_EFFECTIVE
       : (parent ? CONSUMER_PARENT : CONSUMER_DEPENDENCY)
   ```
   
   A project built from its own POM file outside a reactor is therefore treated 
as a dependency POM (`CONSUMER_DEPENDENCY`) whenever validation is below STRICT 
or plugin processing is off. That is exactly how IDEs call it: NetBeans 
(`MavenEmbedder.readProjectWithDependencies`) and m2e (`MavenImpl.readProject`) 
build the user's project at `VALIDATION_LEVEL_MINIMAL` for leniency. 
`DefaultModelBuilder` then evaluates the project's profiles in the 
external-origin sandbox, so `-D` user properties (for example from 
`.mvn/maven.config`) no longer activate its profiles, and file activation is 
skipped.
   
   This is the Maven 4 counterpart of #13347, fixed for 3.10.x in #13394, where 
`getPomFile() != null` now means project mode whatever the validation level, as 
`ModelBuildingRequest.setPomFile` documents.
   
   Proposed: classify a non-parent `build(File)` with a POM file as a project 
build, leaving `build(ModelSource)` and `build(Artifact)` as consumer requests. 
One open question: `BUILD_EFFECTIVE` also switches `DefaultModelBuilder` to 
strict validation (`isBuildRequest() ? VALIDATION_LEVEL_STRICT : ...`), so 
honouring the caller's lenient level may need the request type and the 
validation level to be decoupled rather than a one-line change.
   
   Sylwester
   


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