maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "denis (JIRA)" <j...@codehaus.org>
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

    [ http://jira.codehaus.org/browse/MNG-3287?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=155463#action_155463
] 

denis commented on MNG-3287:
----------------------------

Hi,
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
information.
In "Better Builds with Maven" I found next words:

"In terms of which profile takes precedence, the local-most profile wins. So, POM-specified
profiles
override those in profiles.xml, and profiles.xml overrides those in settings.xml. This is
a
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." (http://maven.apache.org/settings.html#Profiles, 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: http://jira.codehaus.org/browse/MNG-3287
>             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: TestInheritance.zip
>
>
> I have attached a test case to reproduce the problem. It has to be launched with profile
"dev".
> 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: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message