maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "denis (JIRA)" <>
Subject [jira] Commented: (MNG-3287) profiles.xml does not always override pom.xml, at least when using sub-modules
Date Wed, 26 Nov 2008 13:17:19 GMT


denis commented on MNG-3287:

We experience the same problem.

Also I tried to find explanation on priority of properties defined in different places (settings.xml
in user folder, settings.xml in maven folder, profiles.xml pom.xml) and found contradictious
In "Better Builds with Maven" I found next words:

"In terms of which profile takes precedence, the local-most profile wins. So, POM-specified
override those in profiles.xml, and profiles.xml overrides those in settings.xml. This is
pattern that is repeated throughout Maven, that local always wins, because it is assumed to
be a
modification of a more general case." (Chapter 3.8, fourth indentation).

If described in book behavior is right, then this issue is incorrectly defined and launch
of maven for the master pom.xml produces proper results and launch in child pom works inproperly.

At the same time on maven site I found that settings.xml is the most prioritized source:

"If a profile is active from settings, its values will override any equivalently ID'd profiles
in a POM or profiles.xml file." (, second indentation)

Rule from site contradicts with rule from book.

I didn't found any explanations about priorities for settings.xml in user folder and settings.xml
in maven conf folder.

As for our company, the expected behavior described in issue (when properties from profiles.xml
override the same ones from pom.xml) is preferred way to deal with profiles.

Correct me if I am worng. Thanks in advance.

Regards, Denis.

> profiles.xml does not always override pom.xml, at least when using sub-modules
> ------------------------------------------------------------------------------
>                 Key: MNG-3287
>                 URL:
>             Project: Maven 2
>          Issue Type: Bug
>          Components: Inheritance and Interpolation, Profiles
>    Affects Versions: 2.0.7
>            Reporter: Boris Maras
>             Fix For: 2.0.x
>         Attachments:
> I have attached a test case to reproduce the problem. It has to be launched with profile
> I have a master pom.xml and a child pom.xml
> In the master pom.xml is defined a profile "dev", with a property set to the value "dev_pom.xml".
> In the child pom.xml, I display the value of the property with the ant plugin.
> There is also a file profiles.xml that overrides the property of the profile, with the
value "dev_profiles.xml".
> If you run "mvn install -Pdev" on the child module, it displays "dev_profiles.xml".
> If you run "mvn antrun:run -Pdev" on the child module, it also displays "dev_profiles.xml".
> But if you run "mvn install -Pdev" on the master module, it displays "dev_pom.xml".
> It looks like the child module uses the value defined in the master pom, and ignores
the fact that it has been overriden by profiles.xml. And this behavior occurs only if this
child module is called through the master pom.
> Moreover, if you remove the value in the master pom, then the child pom is able to find
the value in profiles.xml.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:


View raw message