You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by ke...@apache.org on 2005/08/12 14:44:29 UTC
svn commit: r232281 -
/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
Author: kenney
Date: Fri Aug 12 05:44:22 2005
New Revision: 232281
URL: http://svn.apache.org/viewcvs?rev=232281&view=rev
Log:
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.)
Modified:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java?rev=232281&r1=232280&r2=232281&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java Fri Aug 12 05:44:22 2005
@@ -186,9 +186,9 @@
}
// TODO: this might result in an artifact "RELEASE" being resolved continuously
- // FIXME: need to find out how a plugin gets marked as 'installed'
- // and no ChildContainer exists. The check for that below fixes
- // the 'Can't find plexus container for plugin: xxx' error.
+ // FIXME: need to find out how a plugin gets marked as 'installed'
+ // and no ChildContainer exists. The check for that below fixes
+ // the 'Can't find plexus container for plugin: xxx' error.
if ( !pluginCollector.isPluginInstalled( plugin ) || container.getChildContainer( plugin.getKey() ) == null )
{
try
@@ -768,7 +768,8 @@
}
}
- if ( fieldValue == null )
+ // only mark as invalid if there are no child nodes
+ if ( fieldValue == null && (value == null || value.getChildCount() == 0 ) )
{
parameter.setExpression( expression );
invalidParameters.add( parameter );
@@ -839,10 +840,10 @@
for ( Iterator it = mojoDescriptor.getParameters().iterator(); it.hasNext(); )
{
Parameter parameter = (Parameter) it.next();
-
+
String paramName = parameter.getName();
String alias = parameter.getAlias();
-
+
PlexusConfiguration pomConfig = fromPom.getChild( paramName );
PlexusConfiguration aliased = null;
@@ -866,11 +867,11 @@
}
boolean addedPomConfig = false;
-
+
if ( pomConfig != null )
{
pomConfig = buildTopDownMergedConfiguration( pomConfig, mojoConfig );
-
+
if ( StringUtils.isNotEmpty( pomConfig.getValue( null ) ) || pomConfig.getChildCount() > 0 )
{
result.addChild( pomConfig );
@@ -920,13 +921,28 @@
for ( int i = 0; i < attributeNames.length; i++ )
{
String attributeValue = recessive.getAttribute( attributeNames[i], null );
-
+ // TODO: recessive seems to be dominant here?
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;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org