Skip to content

Remove Profile getSource / setSource#12377

Open
gnodet wants to merge 3 commits into
apache:masterfrom
gnodet:fix-2569-remove-profile-getSource
Open

Remove Profile getSource / setSource#12377
gnodet wants to merge 3 commits into
apache:masterfrom
gnodet:fix-2569-remove-profile-getSource

Conversation

@gnodet

@gnodet gnodet commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Removes Profile.getSource(), Profile.setSource(), Profile.SOURCE_POM, and Profile.SOURCE_SETTINGS starting at model version 4.2.0 (per Remove profile getSource / setSource #2569)
  • The 4.0.0 and 4.1.0 model versions retain these methods for backward compatibility (the 4.0.0 segment now uses its own field instead of delegating to the API model)
  • Replaces usages in the impl layer with InputLocation / InputSource checks: POM profiles are identified by having a non-null InputSource.getModelId()
  • The compat layer is unchanged — it still has getSource()/setSource() via its own model code segment

Files changed (3):

  • api/maven-api-model/src/main/mdo/maven.mdo — split 4.1.0+ segment into 4.1.0/4.1.99 (keeps source methods) and 4.2.0+ (removes them); fix 4.0.0/4.0.99 to use own field instead of delegating
  • impl/maven-impl/.../DefaultProfileSelector.java — replace Profile.SOURCE_POM.equals(profile.getSource()) with isFromPom() using InputSource.getModelId()
  • impl/maven-impl/.../SettingsUtilsV4.java — remove value.setSource("settings.xml")

Closes #2569

Test plan

  • Full build passes (all 38 modules, all tests green)
  • API Profile (4.2.0+) no longer has getSource/setSource
  • Compat Profile retains getSource/setSource via own field
  • No japicmp compatibility violations
  • CI build passes

🤖 Generated with Claude Code

@gnodet gnodet force-pushed the fix-2569-remove-profile-getSource branch from e26615d to 852c95f Compare June 26, 2026 07:38
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>
@gnodet gnodet force-pushed the fix-2569-remove-profile-getSource branch from 852c95f to 5e98283 Compare June 26, 2026 08:13
gnodet and others added 2 commits June 26, 2026 09:26
…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>
@gnodet gnodet marked this pull request as ready for review June 26, 2026 14:20
@gnodet gnodet added this to the 4.1.0 milestone Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove profile getSource / setSource

1 participant