Improving error reporting when execution id's collide.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@191669 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2005-06-21 15:36:00 +00:00
parent 6cd2e31078
commit 9dfc1f9962
1 changed files with 15 additions and 5 deletions

View File

@ -267,9 +267,11 @@ public class DefaultMavenProjectBuilder
for ( Iterator i = lineage.iterator(); i.hasNext(); ) for ( Iterator i = lineage.iterator(); i.hasNext(); )
{ {
Model current = ( (MavenProject) i.next() ).getModel(); MavenProject currentProject = (MavenProject) i.next();
forcePluginExecutionIdCollision( current ); Model current = currentProject.getModel();
forcePluginExecutionIdCollision( pomLocation, current );
modelInheritanceAssembler.assembleModelInheritance( current, previous ); modelInheritanceAssembler.assembleModelInheritance( current, previous );
@ -288,7 +290,8 @@ public class DefaultMavenProjectBuilder
return project; return project;
} }
private void forcePluginExecutionIdCollision( Model model ) private void forcePluginExecutionIdCollision( String pomLocation, Model model )
throws ProjectBuildingException
{ {
Build build = model.getBuild(); Build build = model.getBuild();
@ -303,8 +306,15 @@ public class DefaultMavenProjectBuilder
Plugin plugin = (Plugin) it.next(); Plugin plugin = (Plugin) it.next();
// this will force an IllegalStateException, even if we don't have to do inheritance assembly. // this will force an IllegalStateException, even if we don't have to do inheritance assembly.
try
{
plugin.getExecutionsAsMap(); plugin.getExecutionsAsMap();
} }
catch ( IllegalStateException collisionException )
{
throw new ProjectBuildingException( "Detected illegal plugin-execution configuration in: " + pomLocation, collisionException );
}
}
} }
} }
} }
@ -600,7 +610,7 @@ public class DefaultMavenProjectBuilder
Model superModel = readModel( url ); Model superModel = readModel( url );
forcePluginExecutionIdCollision( superModel ); forcePluginExecutionIdCollision( "<super-POM>", superModel );
return superModel; return superModel;
} }