maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörg Schaible <>
Subject Re: Maven profiles activations
Date Fri, 25 Mar 2011 06:37:39 GMT
Hi Rafael,

Rafael Vanderlei wrote:

> Jörg, I understood when you first said that the way Maven is currently
> implemented it does not work this way.
> I'm just wondering if there is a suitable reason for that. So what I still
> dont understand is "if a property declared in a parent pom can be used on
> the child pom for other purposes, WHY cant it be used to activate a
> profile defined in that child pom?"
> Maybe it's just a matter that maven developers did not think about and
> maybe could be simply implemented to work this way.

On top of Benjamin's answer you have to understand *when* Maven is resolving 
the profiles and *when* the properties. The properties are determined from 
the "effective" pom for the current project i.e. the project model that is 
the result of merging all inherited POMs and active profiles into the final 
one that is used to build the project. This "effective" pom *is* what 
defines your project build - including the properties, because they are part 
of your final project definition.

The profiles are used to modify this project model for alternate builds, 
they create a different "effective" pom i.e. the result is more or less a 
different project. Since the properties are part of the model, they cannot 
be used to modify it again - this is the chicken and egg problem. In the 
light of this it is unfortunate that the tag in the activation is named 
"property" instead of "systemProperty", because most people make the wrong 

Forget your assumption of evaluating the parent pom first - the model has to 
be complete to evaluate anything. As a consequence of this behavior you can 
use a property in the parent, but define (or overwrite) it in the child.

- Jörg

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message