Made buildTopDownMergedConfiguration really recursive - in most cases it didn't.

Fixed a merge problem where only direct children of <configuration> in the POM
appeared in the merged configuration.

(like maven-antrun-plugin, the 'tasks' configuration tag didn't have any
value, but has children. After the merge, the children were gone,
and it was marked as having no value, and hence the field was not updated.)


git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@232281 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Kenney Westerhof 2005-08-12 12:44:22 +00:00
parent 0b4aa2dc41
commit 1311273aa6
1 changed files with 28 additions and 12 deletions

View File

@ -186,9 +186,9 @@ public class DefaultPluginManager
} }
// TODO: this might result in an artifact "RELEASE" being resolved continuously // TODO: this might result in an artifact "RELEASE" being resolved continuously
// FIXME: need to find out how a plugin gets marked as 'installed' // FIXME: need to find out how a plugin gets marked as 'installed'
// and no ChildContainer exists. The check for that below fixes // and no ChildContainer exists. The check for that below fixes
// the 'Can't find plexus container for plugin: xxx' error. // the 'Can't find plexus container for plugin: xxx' error.
if ( !pluginCollector.isPluginInstalled( plugin ) || container.getChildContainer( plugin.getKey() ) == null ) if ( !pluginCollector.isPluginInstalled( plugin ) || container.getChildContainer( plugin.getKey() ) == null )
{ {
try try
@ -768,7 +768,8 @@ public class DefaultPluginManager
} }
} }
if ( fieldValue == null ) // only mark as invalid if there are no child nodes
if ( fieldValue == null && (value == null || value.getChildCount() == 0 ) )
{ {
parameter.setExpression( expression ); parameter.setExpression( expression );
invalidParameters.add( parameter ); invalidParameters.add( parameter );
@ -920,11 +921,26 @@ public class DefaultPluginManager
for ( int i = 0; i < attributeNames.length; i++ ) for ( int i = 0; i < attributeNames.length; i++ )
{ {
String attributeValue = recessive.getAttribute( attributeNames[i], null ); String attributeValue = recessive.getAttribute( attributeNames[i], null );
// TODO: recessive seems to be dominant here?
result.setAttribute( attributeNames[i], attributeValue ); result.setAttribute( attributeNames[i], attributeValue );
} }
}
mergeConfiguration( result, recessive ); PlexusConfiguration[] children = dominant.getChildren();
for ( int i = 0; i < children.length; i++ )
{
PlexusConfiguration childDom = children[i];
PlexusConfiguration childRec = recessive == null ? null : recessive.getChild( childDom.getName(), false );
if ( childRec != null )
{
result.addChild( buildTopDownMergedConfiguration( childDom, childRec ) );
}
else
{ // FIXME: copy, or use reference?
result.addChild( copyConfiguration( childDom ) );
}
} }
return result; return result;