o Fixing a small bug that would cause a NPE if a plugin doesn't contain any mojos.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@180000 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Trygve Laugstol 2005-06-04 16:10:13 +00:00
parent 40d47927de
commit d34ec0926a
1 changed files with 21 additions and 18 deletions

View File

@ -251,30 +251,33 @@ public class DefaultLifecycleExecutor
Map goalMap = plugin.getGoalsAsMap();
for ( Iterator j = pluginDescriptor.getMojos().iterator(); j.hasNext(); )
if ( pluginDescriptor.getMojos() != null )
{
MojoDescriptor mojoDescriptor = (MojoDescriptor) j.next();
// TODO: remove later
if ( mojoDescriptor.getGoal() == null )
for ( Iterator j = pluginDescriptor.getMojos().iterator(); j.hasNext(); )
{
throw new LifecycleExecutionException(
"The plugin " + artifactId + " was built with an older version of Maven" );
}
MojoDescriptor mojoDescriptor = (MojoDescriptor) j.next();
// TODO: remove later
if ( mojoDescriptor.getGoal() == null )
{
throw new LifecycleExecutionException(
"The plugin " + artifactId + " was built with an older version of Maven" );
}
Goal goal = (Goal) goalMap.get( mojoDescriptor.getGoal() );
Goal goal = (Goal) goalMap.get( mojoDescriptor.getGoal() );
if( goalMap.isEmpty() )
{
configureMojoPhaseBinding( mojoDescriptor, phaseMap, session.getSettings() );
}
else if ( goal != null )
{
// We have to check to see that the inheritance rules have been applied before binding this mojo.
if( goal.isInheritanceApplied() || mojoDescriptor.isInheritedByDefault() )
if( goalMap.isEmpty() )
{
configureMojoPhaseBinding( mojoDescriptor, phaseMap, session.getSettings() );
}
else if ( goal != null )
{
// We have to check to see that the inheritance rules have been applied before binding this mojo.
if( goal.isInheritanceApplied() || mojoDescriptor.isInheritedByDefault() )
{
configureMojoPhaseBinding( mojoDescriptor, phaseMap, session.getSettings() );
}
}
}
}
}
@ -450,4 +453,4 @@ public class DefaultLifecycleExecutor
return phases;
}
}
}