[ 
https://jira.codehaus.org/browse/MNG-5643?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=347883#comment-347883
 ] 

Robert Scholte commented on MNG-5643:
-------------------------------------

{quote}Profile properties in pom.xml don't override profile properties in 
settings.xml.{quote}

That's by design. The order in which properties can be overridden is:
1. pom.xml
2. global settings.xml (in $\{maven.home}/conf/)
3. user settings.xml (in $\{user.home}/.m2/)
4. commandline (-Dkey=value)

I noticed you're using an old version of the maven-antrun-plugin. IIRC there 
were issues with inheritance, which should be fixed by now.

> Profile properties in pom.xml don't override profile properties in 
> settings.xml
> -------------------------------------------------------------------------------
>
>                 Key: MNG-5643
>                 URL: https://jira.codehaus.org/browse/MNG-5643
>             Project: Maven 2 & 3
>          Issue Type: Bug
>    Affects Versions: 3.2.1
>            Reporter: Thomas Beauvais
>         Attachments: pom.xml, settings.xml
>
>
> Profile properties in pom.xml don't override profile properties in 
> settings.xml.
> The goal is to provide team developers with a single settings.xml with useful 
> profiles.  Then, each project will override profile properties if necessary.
> In the following example we want to switch the $\{weblogic.host} property 
> when enabled in the IDE or from the command line via: mvn -P stage
> What is curious is that overriding works when the profile being override 
> exists in the same place as the profile that is doing the overriding.  What 
> this means is if all the profiles are in either the pom.xml OR settings.xml 
> then everything works as expected.
> Normally, if the "stage" profile isn't actually present in the pom.xml I 
> would get this:
> {noformat}[WARNING] The requested profile "stage" could not be activated 
> because it does not exist.{noformat}
> But there is no warning about the profile "stage" because it does actually 
> existing.  The "stage" profile does exist in the pom.xml!
> Attached are sample pom.xml and settings.xml
> The command:
> {{mvn -P stage generate-resources}}
> The current output is:
> {noformat}
> [INFO] --- maven-antrun-plugin:1.3:run (default) @ simple-web ---
> [INFO] Executing tasks
>      [echo] WebLogic: localhost
> [INFO] Executed tasks
> {noformat}
> The expected output is:
> {noformat}
> [INFO] --- maven-antrun-plugin:1.3:run (default) @ simple-web ---
> [INFO] Executing tasks
>      [echo] WebLogic: 192.168.0.123
> [INFO] Executed tasks
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.1.6#6162)

Reply via email to