cpovirk commented on issue #13390:
URL: https://github.com/apache/maven/issues/13390#issuecomment-6084421416

   I also hit trouble profile trouble in 
https://github.com/google/auto/pull/2160. Gemini suspects that my problem there 
is an intentional behavior change, while the problem in _this_ issue is a bug 
and #13347 is somewhere in between ("embedded `ModelBuilder` callers (like 
IDEs) who explicitly pass `-Dmaven.model.dependencyInterpolation.full=true` 
expected that opt-out flag to restore full 3.9 behavior for profile activation 
too, not just interpolation.").
   
   This is mostly over my head, so I can't vouch for it, but in case it's of 
any help:
   
   > \[https://github.com/apache/maven/issues/13347, 
https://github.com/apache/maven/issues/13390, and the problems seen in 
google/auto#2160\] stem from the dependency-POM profile hardening introduced in 
Maven 3.10.0 (commit 03c947d8 + PR 
[apache/maven#13114](https://github.com/apache/maven/pull/13114), backported 
for [apache/maven#13084](https://github.com/apache/maven/issues/13084)) inside 
`org.apache.maven.model.building.DefaultModelBuilder`:
   > 
   > ```java
   > boolean externalModel = isExternalModelBuildingRequest(request);
   > List<Profile> profilesToEvaluate =
   >     externalModel ? withoutFileActivation(tmpModel.getProfiles()) : 
tmpModel.getProfiles();
   > List<Profile> activePomProfiles = profileSelector.getActiveProfiles(
   >     profilesToEvaluate,
   >     externalModel ? externalActivationContext(profileActivationContext) : 
profileActivationContext,
   >     problems);
   > ```
   > 
   > Here is how each issue maps to those two lines:
   > 
   > 1. **Our `auto` / `compile-testing` failure (`withoutFileActivation`) — 
`<activation><file>`:**
   >    - Triggered by `withoutFileActivation(tmpModel.getProfiles())`, which 
**intentionally** strips all `<activation><file>...</file></activation>` 
profiles when building external/dependency POMs (`compile-testing` uses 
`<file><exists>${java.home}/../lib/tools.jar</exists></file>`).
   > 2. **[apache/maven#13347](https://github.com/apache/maven/issues/13347) 
(`externalActivationContext`) — `<activation><property>` ignoring user 
properties:**
   >    - Triggered by `externalActivationContext(profileActivationContext)` 
ignoring `request.getUserProperties()`, so `<property>` profiles in external 
POMs can no longer be activated via user properties (`-Dfoo=true`), even when 
`-Dmaven.model.dependencyInterpolation.full=true` is set.
   > 3. **[apache/maven#13390](https://github.com/apache/maven/issues/13390) 
(`externalActivationContext`) — `<activation><property>` self-activating from 
POM `<properties>`:**
   >    - Also triggered by 
`externalActivationContext(profileActivationContext)`, which merges 
`context.getProjectProperties()` into `getSystemProperties()`, accidentally 
causing a dependency POM's own `<properties>` block to activate its own 
`<property>` profiles.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to