You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "gnodet (via GitHub)" <gi...@apache.org> on 2026/10/13 00:12:09 UTC
[PR] [4.0.x] Fix #13390: stop POM properties from self-activating profiles in external builds [maven]
gnodet opened a new pull request, #13452:
URL: https://github.com/apache/maven/pull/13452
## Summary
Backport of #13450 to `maven-4.0.x`.
- A dependency POM's own `<properties>` must not activate its property-based profiles
- The sandbox was merging model properties into the system-property lookup, causing POMs like jruby-base to self-activate profiles unintentionally (#13390)
- Remove the merge — only system properties and negated-property checks drive profile activation in external builds, restoring 3.9.x semantics
- This does **not** affect #13084 (RESTEasy), which uses a negated-property profile (`!resteasy.dependencies.eap`) that works correctly without the merge
### Changes
**Both stacks** (compat `maven-model-builder` and new `impl/maven-impl`):
- `DefaultModelBuilder` / `DefaultProfileActivationContext`: remove POM-property merge from external-model sandbox
- `PropertyProfileActivator`: update comments
- `ProfileActivationContext` interfaces: update Javadoc on model/project properties
**Tests**: added jruby-style (#13390 regression) and resteasy-style (#13084 non-regression) test cases
## Test plan
- [x] Compat `ExternalModelProfileActivationTest` — 12 tests pass
- [ ] Impl `DefaultModelBuilderTest` — has pre-existing compile failure on 4.0.x (unrelated)
- [ ] Integration test with jruby-base-9.4.2.0 dependency (manual verification)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [4.0.x] Fix #13390: stop POM properties from self-activating profiles in external builds [maven]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet merged PR #13452:
URL: https://github.com/apache/maven/pull/13452
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [4.0.x] Fix #13390: stop POM properties from self-activating profiles in external builds [maven]
Posted by "gnodet-bot (via GitHub)" <gi...@apache.org>.
gnodet-bot commented on code in PR #13452:
URL: https://github.com/apache/maven/pull/13452#discussion_r4264956540
##########
impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultProfileActivationContext.java:
##########
@@ -418,9 +411,15 @@ public String getUserProperty(String key) {
return null;
}
+ /**
+ * Model properties are suppressed: a dependency POM's own {@code <properties>} must not
+ * activate its own profiles. Both {@link org.apache.maven.impl.model.profile.PropertyProfileActivator} and
+ * {@link org.apache.maven.impl.model.profile.ConditionProfileActivator} call
+ * {@code getModelProperty()} directly, so returning {@code null} here closes the gap.
Review Comment:
💡 **Javadoc inaccuracy:** Same as above — `PropertyProfileActivator` does not call `getModelProperty()`. Only `ConditionProfileActivator` does.
```suggestion
/**
* Model properties are suppressed: a dependency POM's own {@code <properties>} must not
* activate its own profiles. {@link org.apache.maven.impl.model.profile.ConditionProfileActivator}
* calls {@code getModelProperty()} directly, so returning {@code null} here closes the gap.
*/
```
##########
impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultProfileActivationContext.java:
##########
@@ -369,14 +369,16 @@ public DefaultProfileActivationContext setModel(Model model) {
* <p>
* The sandboxed context:
* <ul>
- * <li><b>Merges model properties into system property lookups</b>: system properties
- * ({@code java.version}, {@code os.name}, …) are checked first (preserving JDK/OS
- * activation), then model properties (the POM's own {@code <properties>}) are used
- * as a fallback. This makes POM-declared properties visible to the
- * {@code PropertyProfileActivator} without modifying the activator's lookup chain
- * for non-external models.</li>
+ * <li><b>Preserves system properties</b> ({@code java.version}, {@code os.name}, …)
+ * so JDK/OS activation works.</li>
* <li><b>Suppresses user properties</b> (consumer {@code -D} flags): they were not
* set for the dependency and must not accidentally activate its profiles.</li>
+ * <li><b>Suppresses model properties</b>: a dependency POM's own
+ * {@code <properties>} must not activate its own property-based or
+ * condition-based profiles (see #13390). Both {@link org.apache.maven.impl.model.profile.PropertyProfileActivator}
+ * and {@link org.apache.maven.impl.model.profile.ConditionProfileActivator}
+ * read model properties directly via {@code getModelProperty()}, so the
+ * sandbox overrides that method to return {@code null}.</li>
Review Comment:
💡 **Javadoc inaccuracy:** `PropertyProfileActivator` does not call `getModelProperty()` — it only checks `getUserProperty()` and `getSystemProperty()`. Only `ConditionProfileActivator` calls `getModelProperty()` directly (via `doGetProperty()`).
```suggestion
* <li><b>Suppresses model properties</b>: a dependency POM's own
* {@code <properties>} must not activate its own property-based or
* condition-based profiles (see #13390).
* {@link org.apache.maven.impl.model.profile.ConditionProfileActivator}
* reads model properties directly via {@code getModelProperty()}, so the
* sandbox overrides that method to return {@code null}.</li>
```
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org