On 25 March 2011 13:36, Rafael Vanderlei <[email protected]> wrote: > Jörg and Benjamin, thanks for your explanation. I understand now that > profiles are not allowed to be activated by properties defined inside a POM > because it could form cycles (though maybe with some design decisions it > could be avoided, but I have no idea of Maven code to give any suggestions > about that). > > And, Jörg, about the name of the tag in the activation, I believe it´s > property instead of systemProperty because there are both options to > activate it: one using a system/environment property/variable and other > using a maven property (although in the latter case its necessary to be a > property defined in the command line)
properties defined by the CLI _are_ system properties. > > Regards, > Rafael Vanderlei > > On Fri, Mar 25, 2011 at 3:37 AM, Jörg Schaible > <[email protected]>wrote: > >> 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 >> association. >> >> 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: [email protected] >> For additional commands, e-mail: [email protected] >> >> > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
