o Fixed order of plugin configuration merging

git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@771151 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-05-03 23:47:56 +00:00
parent ba35f36fbd
commit 4279de6540
1 changed files with 33 additions and 21 deletions

View File

@ -191,32 +191,44 @@ public class DefaultMavenProjectBuilder
pln.add(copy);
}
// Merge the various sources for mojo configuration:
// 1. default values from mojo descriptor
// 2. POM values from per-plugin configuration
// 3. POM values from per-execution configuration
// These configuration sources are given in increasing order of dominance.
Set<Plugin> pl = lifecycle.populateDefaultConfigurationForPlugins(new HashSet<Plugin>(pln),
project, configuration.getLocalRepository());
for (Plugin buildPlugin : pl) {
Xpp3Dom dom = (Xpp3Dom) buildPlugin.getConfiguration();
Plugin x = containsPlugin(buildPlugin, project.getModel()
.getBuild().getPlugins());
for ( Plugin buildPlugin : pl )
{
Xpp3Dom dom = (Xpp3Dom) buildPlugin.getConfiguration();
Plugin x = containsPlugin( buildPlugin, project.getModel().getBuild().getPlugins() );
for (PluginExecution e : buildPlugin.getExecutions()) {
for (String g : e.getGoals()) {
if (x != null) {
PluginExecution pe = contains(g, x.getExecutions());
if (pe != null) {
Xpp3Dom dom1 = Xpp3Dom.mergeXpp3Dom(
(Xpp3Dom) pe.getConfiguration(),
(Xpp3Dom) e.getConfiguration());
e.setConfiguration(dom1);
}
}
Xpp3Dom dom1 = Xpp3Dom.mergeXpp3Dom((Xpp3Dom) e
.getConfiguration(), dom);
e.setConfiguration(dom1);
}
}
for ( PluginExecution e : buildPlugin.getExecutions() )
{
if ( dom != null )
{
Xpp3Dom dom1 = Xpp3Dom.mergeXpp3Dom( new Xpp3Dom( dom ), (Xpp3Dom) e.getConfiguration() );
e.setConfiguration( dom1 );
}
for ( String g : e.getGoals() )
{
if ( x != null )
{
PluginExecution pe = contains( g, x.getExecutions() );
if ( pe != null )
{
Xpp3Dom dom2 =
Xpp3Dom.mergeXpp3Dom( (Xpp3Dom) pe.getConfiguration(),
(Xpp3Dom) e.getConfiguration() );
e.setConfiguration( dom2 );
}
}
}
}
}
}
project.getModel().getBuild().setPlugins(new ArrayList<Plugin>(pl));
}