Skip to content

[MNG-6787] Document activeByDefault suppression semantics and POM/external asymmetry - #1691

Open
gnodet wants to merge 1 commit into
apache:masterfrom
gnodet:fix/MNG-6787-activeByDefault-docs
Open

gnodet wants to merge 1 commit into
apache:masterfrom
gnodet:fix/MNG-6787-activeByDefault-docs

Conversation

@gnodet

@gnodet gnodet commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Improves the introduction-to-profiles guide to accurately document the activeByDefault suppression behavior, including the intentional asymmetry between POM and external (settings.xml) profiles introduced by the fix in apache/maven#13254.

Changes

"Profiles activated by default" intro section

The previous single sentence described POM-only behavior and was technically inaccurate (it said "activated using one of the previously described methods" without distinguishing -P vs condition activation). Now:

  • Clearly states that any same-POM activation (condition or -P) suppresses POM activeByDefault profiles
  • Adds a Note explaining that external profiles in settings.xml behave differently and points readers to the subsection

"Active by default" subsection

The previous text said this flag is "only evaluated if no other profile is explicitly activated via command line, settings.xml or activated through some other activator" — which was both inaccurate and incomplete. Now replaced with a clear bullet breakdown:

  • POM profiles: suppressed by any same-POM activation (condition or -P)
  • External profiles: suppressed only by explicit -P, with rationale explaining why the asymmetry is intentional (external profiles carry environment config like repos/credentials that shouldn't be wiped out by a JDK-triggered POM profile)

Related

…ernal asymmetry

The previous documentation conflated two different suppression behaviors:

- POM activeByDefault profiles: suppressed by any profile activation in
  the same POM, whether via -P or a condition activator (file, property,
  JDK, OS).
- External activeByDefault profiles (settings.xml): suppressed only by
  an explicit -P / --activate-profiles request. Condition-based POM
  profile activation does NOT suppress them. This asymmetry is
  intentional: external profiles typically carry environment config
  (repositories, credentials) that should remain active regardless of
  which POM build-variant profile the environment triggers.

Also clarify in the 'Profiles activated by default' intro section that
the cross-boundary asymmetry exists and point readers to the detailed
subsection.

Relates to: apache/maven#8488 (MNG-6787)
The suppression behavior differs depending on where the profile is defined:

- **POM profiles** (`pom.xml`): an `activeByDefault` profile is suppressed as soon as any other profile in the same POM becomes active, whether via explicit `-P` or via a condition activator (file, property, JDK, OS).
- **External profiles** (`settings.xml`): an `activeByDefault` profile is only suppressed when another profile is explicitly requested via `-P` / `--activate-profiles`. A condition-based POM profile activating does **not** suppress external `activeByDefault` profiles. This asymmetry is intentional: external profiles typically carry environment configuration (repositories, credentials) that should remain active regardless of which build-variant POM profile is triggered by the environment.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I know profile defined in settings.xml with activeByDefault are not deactivated in any condition.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gnodet Could you take a look at this comment and check if it needs to be updated. Thank you.

@slachiewicz slachiewicz added the documentation Improvements or additions to documentation label Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants