gnodet commented on issue #2569:
URL: https://github.com/apache/maven/issues/2569#issuecomment-6664718954

   Hi @codewithsinchana, thanks for your interest in contributing!
   
   There is already an open PR addressing this issue: #12377. That PR removes 
`getSource()`/`setSource()` from the API model `Profile` starting at model 
version 4.2.0, and replaces the profile-origin check in the impl layer with 
`InputSource.getModelId()`-based detection — POM profiles get a non-empty 
`modelId` during parsing, settings profiles get an empty string.
   
   However, there is one outstanding issue in the compat layer that needs to be 
fixed before #12377 can merge: when 
`SettingsUtilsV4.convertFromSettingsProfile()` stops calling 
`setSource("settings.xml")` (as #12377 does), the compat 
`DefaultProfileSelector` will start treating settings `activeByDefault` 
profiles as POM profiles, potentially suppressing them when any POM profile is 
explicitly activated.
   
   The fix belongs in `compat/maven-compat`'s 
`SettingsUtils.convertFromSettingsProfile()`, which should explicitly mark the 
result:
   
   ```java
   public static org.apache.maven.model.Profile 
convertFromSettingsProfile(Profile settingsProfile) {
       org.apache.maven.model.Profile result = new 
org.apache.maven.model.Profile(
               
SettingsUtilsV4.convertFromSettingsProfile(settingsProfile.getDelegate()));
       result.setSource(org.apache.maven.model.Profile.SOURCE_SETTINGS);
       return result;
   }
   ```
   
   Your PR #13854 was on the right track — the AI bot review rejected it based 
on the current master (where `SettingsUtilsV4` still sets the source), but 
after #12377 merges the fix will be needed. If you'd like to contribute, please 
open a PR **targeting the `fix-2569-remove-profile-getSource` branch on 
https://github.com/gnodet/maven** (the branch backing #12377) that:
   1. Applies the fix above to the compat `SettingsUtils` class
   2. Adds a regression test on the compat `DefaultProfileSelector` verifying 
that settings `activeByDefault` profiles are not suppressed when a POM profile 
is activated
   
   That would unblock #12377. Thank you!


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