Forcing collision of plugin-execution id's in non-inherited, direct-goal invocation scenarios.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@191621 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2005-06-21 04:20:18 +00:00
parent bea9eca2f6
commit 7acd75ed8a
1 changed files with 32 additions and 3 deletions

View File

@ -243,13 +243,16 @@ public class DefaultMavenProjectBuilder
}
MavenProject project = assembleLineage( model, lineage, aggregatedRemoteWagonRepositories, localRepository );
// we don't have to force the collision exception for superModel here, it's already been done in getSuperModel()
Model previous = superModel;
for ( Iterator i = lineage.iterator(); i.hasNext(); )
{
Model current = ( (MavenProject) i.next() ).getModel();
forcePluginExecutionIdCollision( current );
modelInheritanceAssembler.assembleModelInheritance( current, previous );
previous = current;
@ -266,6 +269,28 @@ public class DefaultMavenProjectBuilder
return project;
}
private void forcePluginExecutionIdCollision( Model model )
{
Build build = model.getBuild();
if ( build != null )
{
List plugins = build.getPlugins();
if ( plugins != null )
{
for ( Iterator it = plugins.iterator(); it.hasNext(); )
{
Plugin plugin = (Plugin) it.next();
// this will force an IllegalStateException, even if we don't have to do inheritance assembly.
plugin.getExecutionsAsMap();
}
}
}
}
/**
* @todo can this take in a model instead of a project and still be successful?
* @todo In fact, does project REALLY need a MavenProject as a parent? Couldn't it have just a wrapper around a
@ -541,7 +566,11 @@ public class DefaultMavenProjectBuilder
{
URL url = DefaultMavenProjectBuilder.class.getResource( "pom-" + MAVEN_MODEL_VERSION + ".xml" );
return readModel( url );
Model superModel = readModel( url );
forcePluginExecutionIdCollision( superModel );
return superModel;
}
public void contextualize( Context context )