[ http://jira.codehaus.org/browse/MNG-2275?page=comments#action_67948 ] 

John Casey commented on MNG-2275:
---------------------------------

profiles aren't designed to be inherited at all, but only injected into the 
immediate POM they reference...the behaviors from the profile are then passed 
down via normal POM inheritance. Otherwise, managing a local project's build 
can become very arcane, since it will have to deal with profiles that magically 
appear and start mucking with it's behavior. Also, you get into situations of 
multiple inheritance of the same data if you inject a parent POM, then inherit 
the profile from parent to child, then inject again in the child. If you only 
inject in the child, then you have an issue of parent-POM-profiles taking 
precedence over locally-specified properties and such.

> profiles should be merged when inherited
> ----------------------------------------
>
>          Key: MNG-2275
>          URL: http://jira.codehaus.org/browse/MNG-2275
>      Project: Maven 2
>         Type: Bug

>   Components: Inheritence and Interpolation
>     Versions: 2.0.4
>     Reporter: Brian Fox

>
>
> I have some default profiles setup in a super parent pom that all projects 
> inherit from. In some projects I want to change the active profile, but not 
> from the CLI because other projects running in the same multi-project build 
> need to have the normal default. I attempted to work around this by setting 
> the profile to be active on a property in the child pom. See below for parent 
> and child. It appears that when I do this, the child profile replaces the 
> parent. It should be merged so that the properties are pulled from the parent 
> and uses the activation from the child.
> parent:
> <!-- Setup default profiles. -->
> <profiles>
>       <profile>
>               <id>dev</id>
>               <properties>
>                       
> <profile-default.values>src/main/filters/dev-default.values</profile-default.values>
>               </properties>                   
>       </profile>
>       <profile>
>               <id>auto-test</id>
>               <properties>
>                       
> <profile-default.values>src/main/filters/auto-test-default.values</profile-default.values>
>               </properties>                   
>       </profile>
>       <profile>
>               <id>man-test</id>
>               <properties>
>                       
> <profile-default.values>src/main/filters/man-test-default.values</profile-default.values>
>               </properties>                   
>       </profile>
>       <profile>
>               <id>prod</id>
>               <properties>
>                       
> <profile-default.values>src/main/filters/prod-default.values</profile-default.values>
>               </properties>                   
>       </profile>
> </profiles>
>  
>  
> child pom..
>  
>    <!--  This is the property to override for custom properties in this 
> project-->
>   <properties>
>         
> <client-ct-package.values>${user.default.values}</client-ct-package.values>
>   </properties>
>   <build>
>     <filters>
>       <filter>${profile-default.values}</filter>
>       <filter>${user.default.values}</filter>
>       <filter>${client-ct-package.values}</filter>
>     </filters>
>     <resources>
>       <resource>
>         <directory>src/main/resources</directory>
>         <filtering>true</filtering>
>       </resource>
>     </resources>
>   </build>
>    <!-- temporary to activate the CT production values until all projects can 
> have prod values -->
>     <profiles>
>      <profile>
>       <id>prod</id>
>       <activation>
>           <property>
>              <name>deploy-ct</name>
>           </property>
>       </activation>

-- 
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

Reply via email to