o Fixed model builder to expand plugin management configuration, too

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@807669 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-08-25 15:25:42 +00:00
parent fba1a8f5e7
commit 8b381cdbd6
1 changed files with 30 additions and 12 deletions

View File

@ -19,10 +19,13 @@ package org.apache.maven.model.plugin;
* under the License.
*/
import java.util.List;
import org.apache.maven.model.Build;
import org.apache.maven.model.Model;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.PluginExecution;
import org.apache.maven.model.PluginManagement;
import org.apache.maven.model.ReportPlugin;
import org.apache.maven.model.ReportSet;
import org.apache.maven.model.Reporting;
@ -48,19 +51,13 @@ public class DefaultPluginConfigurationExpander
if ( build != null )
{
for ( Plugin buildPlugin : build.getPlugins() )
{
Xpp3Dom parentDom = (Xpp3Dom) buildPlugin.getConfiguration();
expand( build.getPlugins() );
if ( parentDom != null )
{
for ( PluginExecution execution : buildPlugin.getExecutions() )
{
Xpp3Dom childDom = (Xpp3Dom) execution.getConfiguration();
childDom = Xpp3Dom.mergeXpp3Dom( childDom, new Xpp3Dom( parentDom ) );
execution.setConfiguration( childDom );
}
}
PluginManagement pluginManagement = build.getPluginManagement();
if ( pluginManagement != null )
{
expand( pluginManagement.getPlugins() );
}
}
@ -83,4 +80,25 @@ public class DefaultPluginConfigurationExpander
}
}
private void expand( List<Plugin> plugins )
{
for ( Plugin plugin : plugins )
{
Xpp3Dom pluginConfiguration = (Xpp3Dom) plugin.getConfiguration();
if ( pluginConfiguration != null )
{
for ( PluginExecution execution : plugin.getExecutions() )
{
Xpp3Dom executionConfiguration = (Xpp3Dom) execution.getConfiguration();
executionConfiguration =
Xpp3Dom.mergeXpp3Dom( executionConfiguration, new Xpp3Dom( pluginConfiguration ) );
execution.setConfiguration( executionConfiguration );
}
}
}
}
}