Hello,
I'm seeing some behavior in Maven 4 (beta-5 & rc1) where the order in which
properties are
overridden isn't what I'd expect, and I'd like some help in understanding
what's going on.

I have a project where a property is set in a profile in a grandparent
module (not in the reactor), and then overridden in the properties section
of the parent module (in the reactor). In Maven 3, the value from the
parent module is always used, which is the behavior that I'd expect.

In Maven 4 this is the behavior I'm seeing in recursive builds (so, when
using `-am -pl X` it uses the property from the parent), but for
non-recursive builds (`-pl X`, without `-am`) it uses the property from the
grandparent, not the one from the parent.

I put together a reproducer here
https://github.com/PtrTeixeira/maven-properties-demo/actions/runs/12243758564/job/34154011589.
The property `basepom.test.skip` is set to `true` in a profile in the
grandparent pom here
https://github.com/basepom/basepom/blob/cb792c52689b63fbde5ee6cfda6b1cd7bb70e1f2/poms/oss/pom.xml#L377,
then always overridden in the parent here
https://github.com/PtrTeixeira/maven-properties-demo/blob/0afa19640929ab9606cbaf68e15ead0fda3facb6/pom.xml#L24.
I'd expect `mvn help:evaluate -Dexpression="basepom.test.skip"` to always
be `false`, but specifically when using `mvn4 -Pbasepom.oss-release -pl
core-module help:evaluate -Dexpression="basepom.test.skip"` the result is
`true` (the value from the grandparent) instead. Using `-am -pl
core-module` produces the same result as in Maven 3.

Is this the intended override order in Maven 4? What's the intuition I
should have about what properties have priority?

Thank you!
Peter Teixeira

-- 
We're committed to your privacy. HubSpot utilizes both public information 
and/or the information you provide to us to contact you about our relevant 
content, products, and services. You may unsubscribe 
<mailto:opt-...@hubspot.com?subject=unsubscribe&body=unsubscribe> from 
these communications at any time. For more information, check out our 
Privacy Policy <https://legal.hubspot.com/privacy-policy>.

Reply via email to