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

   Fixes #10427.
   
   ## Problem
   
   Maven 4 can successfully build a project's effective model while failing to 
construct a separate `MavenProject` for its parent. The active parent profiles 
still contribute to the effective model and are recorded in 
`MavenProject#getInjectedProfileIds()`, but `DefaultMaven#getAllProfiles()` 
only searches profiles reachable through `MavenProject#getParent()`.
   
   As a result, Maven incorrectly reports active parent profiles as nonexistent 
when building against an empty local repository.
   
   The failure was reproduced against `jenkinsci/text-finder-plugin` using 
Maven 4.1.0-SNAPSHOT and a new empty local repository:
   
   `mvn -B -ntp -Dmaven.repo.local=/path/to/empty-repository validate`
   
   Before this change, Maven stopped with:
   
   `The requested profiles [might-produce-incrementals, consume-incrementals] 
could not be activated or deactivated because they do not exist.`
   
   ## Change
   
   Include profile IDs already recorded in 
`MavenProject#getInjectedProfileIds()` when collecting the profiles available 
for requested-profile validation.
   
   These IDs represent profiles that have already contributed to the effective 
model. This handles the unavailable-parent-project path without accepting 
arbitrary missing profile names.
   
   A focused regression test covers a project whose effective model contains an 
injected parent profile while its parent `MavenProject` is unavailable.
   
   ## Validation
   
   - The new regression test failed before the production change and passes 
afterward.
   - The patched Maven distribution successfully validates 
`jenkinsci/text-finder-plugin` using a new empty local repository.
   - `MavenITmng7051OptionalProfileActivationTest` passes all five tests, 
including the case confirming that an actually nonexistent required profile 
still fails the build.
   - The focused Core IT reactor verification completed successfully across 88 
modules.
   - Checkstyle, Spotless, Apache RAT, and `git diff --check` passed.
   - The commit has a verified signature.
   
   ## Checklist
   
   - [x] This pull request addresses one issue without unrelated changes.
   - [x] The description explains what the pull request changes, how, and why.
   - [x] The commit has a meaningful subject line and body.
   - [x] A unit test covers the behavioral change and fails without the runtime 
fix.
   - [x] `mvn verify` completed successfully.
   - [x] The relevant Core IT completed successfully.
   - [x] I hereby declare this contribution to be licenced under the [Apache 
License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0).
   - [ ] In any other case, I have filed an [Apache Individual Contributor 
License Agreement](https://www.apache.org/licenses/icla.pdf).


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