From 7acd75ed8ad36708408783efff075610dc669c06 Mon Sep 17 00:00:00 2001 From: John Dennis Casey Date: Tue, 21 Jun 2005 04:20:18 +0000 Subject: [PATCH] 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 --- .../project/DefaultMavenProjectBuilder.java | 35 +++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java b/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java index eef00b520a..6aef286625 100644 --- a/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java +++ b/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java @@ -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 )