You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by "Vincent Massol (JIRA)" <ji...@codehaus.org> on 2005/08/13 22:20:57 UTC

[jira] Commented: (MNG-732) Improve plugin configuration property merge algorithm

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

Vincent Massol commented on MNG-732:
------------------------------------

I think I may have traced it to line 278 of ModelUtils in maven-core:

        Xpp3Dom childConfiguration = (Xpp3Dom) child.getConfiguration();
        Xpp3Dom parentConfiguration = (Xpp3Dom) parent.getConfiguration();

        childConfiguration = Xpp3Dom.mergeXpp3Dom( childConfiguration, parentConfiguration );

Which itself leads to the following method from plexus-util/Xpp3Dom.java in Plexus:

    private static void mergeIntoXpp3Dom( Xpp3Dom dominant, Xpp3Dom recessive )
    {
        // TODO: how to mergeXpp3Dom lists rather than override?
        // TODO: share this as some sort of assembler, implement a walk interface?
        if ( recessive == null )
        {
            return;
        }

        Xpp3Dom[] children = recessive.getChildren();
        for ( int i = 0; i < children.length; i++ )
        {
            Xpp3Dom child = children[i];
            Xpp3Dom childDom = dominant.getChild( child.getName() );
            if ( childDom != null )
            {
                mergeIntoXpp3Dom( childDom, child );
            }
            else
            {
                dominant.addChild( new Xpp3Dom( child ) );
            }
        }
    }

Does my use case correspond to the first todo item in the code?


> Improve plugin configuration property merge algorithm
> -----------------------------------------------------
>
>          Key: MNG-732
>          URL: http://jira.codehaus.org/browse/MNG-732
>      Project: Maven 2
>         Type: Improvement
>   Components: maven-core
>     Versions: 2.0-alpha-3
>     Reporter: Vincent Massol

>
>
> If the property are the same in the parent and the child project, then the parent property is not inherited. This is fine for simple properties but breaks for complex properties such as lists. Here's an example:
> My parent POM:
>   <build>
>     <pluginManagement>
>       <plugins>
>         <plugin>
>           <artifactId>maven-surefire-plugin</artifactId>
>           <configuration>
>             <systemProperties>
>               <property>
>                 <name>cargo.resin3x.port</name>
>                 <value>8280</value>
>               </property>
>               <property>
>                 <name>cargo.resin3x.url</name>
>                 <value>http://www.caucho.com/download/resin-3.0.9.zip</value>
>               </property>
>             </systemProperties>
>           </configuration>
>         </plugin>
>       </plugins>
>     </pluginManagement>
>   </build>
> My child POM:
>   <build>
>     <plugins>
>       <plugin>
>         <artifactId>maven-surefire-plugin</artifactId>
>         <configuration>
>           <systemProperties>
>             <!-- Default list of containers to run on. If you want to shorten or change the
>                  execution of 'samples', simply specify a shorter list of containers on the
>                  command line or in your settings -->
>             <property>
>               <name>cargo.containers</name>
>               <value>resin3x, orion2x, tomcat5x, jetty4xEmbedded</value>
>             </property>
>             <!-- Location where to download and install the containers for the tests -->
>             <property>
>               <name>cargo.install.dir</name>
>               <value>${basedir}/../../target/installs</value>
>             </property>
>           </systemProperties>
>         </configuration>
>       </plugin>
>     </plugins>
>   </build>
> It sounds a reasonable expectations that the system properties will get merged.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org