Skip to content

Honour the full interpolation flag for profile activation of low validation level builds (fix #13347) - #13571

Open
arturobernalg wants to merge 1 commit into
apache:maven-3.10.xfrom
arturobernalg:fix/maven-13347-profile-activation-3.10
Open

arturobernalg wants to merge 1 commit into
apache:maven-3.10.xfrom
arturobernalg:fix/maven-13347-profile-activation-3.10

Conversation

@arturobernalg

Copy link
Copy Markdown
Member

What and why

Since 3.10.0, a model built below VALIDATION_LEVEL_MAVEN_2_0 is treated as a repository POM: its profiles are activated in a sandbox that hides user properties and file activation. maven.model.dependencyInterpolation.full=true is documented as the way to opt out, but it was only honoured by the interpolator. Profile activation ignored it, so a project built at MINIMAL with the flag set still lost its property-activated profiles (#13347).

How

DefaultModelBuilder.isExternalModelBuildingRequest now also checks the flag, through a shared AbstractStringBasedModelInterpolator.isFullExternalInterpolation, so interpolation and activation agree. The flag can be a system or a user property. A POM's own <properties> still do not activate its profiles (#13390).

An explicit marker on the request, set by the artifact descriptor reader instead of inferring it from the validation level, would also fix tools that build projects at MINIMAL without the flag. I left that for a separate change.

Tests

Two new tests in ResolvedDependencyProfileActivationTest fail without the change. maven-model-builder and maven-core pass (420 tests) and spotless is clean. I did not run the integration tests.


To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
check one of the following:

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Clean, minimal fix. The isExternalModelBuildingRequest guard now correctly honours the existing maven.model.dependencyInterpolation.full opt-out flag for profile activation, not just interpolation. The refactoring of restrictExternalModelInterpolation into a shared isFullExternalInterpolation() helper eliminates duplication and is semantically equivalent (De Morgan's law). The orphaned comment removal is appropriate — it was a trailing fragment ending mid-sentence.

One naming observation: isFullExternalInterpolation now governs both interpolation restriction and profile activation scope, so the name is slightly narrower than its actual semantics. Something like isFullExternalModelBuild or isExternalInterpolationEnabled might be more precise — but this is a minor nit, not a blocker.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@arturobernalg

Copy link
Copy Markdown
Member Author

Heads-up: this overlaps with the draft #13394, which fixes the same issue by also requiring getPomFile() == null before treating a build as external. The two changes are complementary rather than alternatives. #13394 fixes projects built from a POM file without any opt-out, and this one makes maven.model.dependencyInterpolation.full also apply to profile activation, as the reproducer in #13347 expects. Both touch isExternalModelBuildingRequest and ResolvedDependencyProfileActivationTest, so whichever lands second needs a rebase. I am happy to rebase this one, or to close it if #13394 is meant to cover everything.

@arturobernalg
arturobernalg force-pushed the fix/maven-13347-profile-activation-3.10 branch from 7817970 to b6272da Compare October 16, 2026 14:44
@arturobernalg

Copy link
Copy Markdown
Member Author

Renamed the helper to isFullExternalModelBuild in b6272da, as suggested, since it now governs profile activation as well as interpolation.

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.

2 participants