Remove Profile getSource / setSource#12377
Open
gnodet wants to merge 3 commits into
Open
Conversation
e26615d to
852c95f
Compare
Remove getSource()/setSource() and SOURCE_POM/SOURCE_SETTINGS constants from the Profile class starting at model version 4.2.0. The 4.0.0 and 4.1.0 model versions retain these methods for backward compatibility. Replace usages in the impl layer (DefaultProfileSelector, SettingsUtilsV4) with InputLocation/InputSource checks. POM-originating profiles are now identified by having a non-null InputSource.getModelId(). The compat layer is unchanged. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
852c95f to
5e98283
Compare
…files Settings profiles converted via SettingsUtilsV4 get an InputSource with modelId="" (empty string, not null), so the check must also exclude empty strings to correctly identify non-POM profiles. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ultProfileSelector Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Removes legacy Profile source tracking (getSource/setSource and related constants) from the API model starting with model version 4.2.0, and updates the impl layer to distinguish POM vs settings profiles via InputLocation/InputSource (per #2569).
Changes:
- Split API model code generation segments so
Profile.getSource/setSourceexist only for 4.0.x and 4.1.x, and are removed for 4.2.0+. - Update
DefaultProfileSelectorto classify “from POM” profiles based on a non-emptyInputSource.getModelId(). - Remove impl-layer writes to
Profile.setSource("settings.xml")and add tests covering the updated activation behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| impl/maven-impl/src/test/java/org/apache/maven/impl/model/DefaultProfileSelectorTest.java | Adds coverage for POM vs settings profile handling using InputSource model id, including edge cases. |
| impl/maven-impl/src/main/java/org/apache/maven/impl/SettingsUtilsV4.java | Stops setting Profile source explicitly; relies on InputLocation/InputSource instead. |
| impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultProfileSelector.java | Replaces Profile.getSource() checks with InputSource.getModelId()-based origin detection. |
| api/maven-api-model/src/main/mdo/maven.mdo | Adjusts generated API model versions: retains source API for 4.0.x/4.1.x and removes it for 4.2.0+. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Profile.getSource(),Profile.setSource(),Profile.SOURCE_POM, andProfile.SOURCE_SETTINGSstarting at model version 4.2.0 (per Remove profile getSource / setSource #2569)InputLocation/InputSourcechecks: POM profiles are identified by having a non-nullInputSource.getModelId()getSource()/setSource()via its own model code segmentFiles changed (3):
api/maven-api-model/src/main/mdo/maven.mdo— split4.1.0+segment into4.1.0/4.1.99(keeps source methods) and4.2.0+(removes them); fix4.0.0/4.0.99to use own field instead of delegatingimpl/maven-impl/.../DefaultProfileSelector.java— replaceProfile.SOURCE_POM.equals(profile.getSource())withisFromPom()usingInputSource.getModelId()impl/maven-impl/.../SettingsUtilsV4.java— removevalue.setSource("settings.xml")Closes #2569
Test plan
getSource/setSourcegetSource/setSourcevia own field🤖 Generated with Claude Code