no root project in reactor

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@291251 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-09-24 05:24:15 +00:00
parent 0fbd59f4f8
commit 661051200d
2 changed files with 87 additions and 78 deletions

View File

@ -172,8 +172,8 @@ public class DefaultLifecycleExecutor
return response; return response;
} }
private void executeTaskSegments( List taskSegments, ReactorManager rm, MavenSession session, MavenProject project, private void executeTaskSegments( List taskSegments, ReactorManager rm, MavenSession session,
EventDispatcher dispatcher ) MavenProject rootProject, EventDispatcher dispatcher )
throws PluginNotFoundException, MojoExecutionException, ArtifactResolutionException, LifecycleExecutionException throws PluginNotFoundException, MojoExecutionException, ArtifactResolutionException, LifecycleExecutionException
{ {
for ( Iterator it = taskSegments.iterator(); it.hasNext(); ) for ( Iterator it = taskSegments.iterator(); it.hasNext(); )
@ -182,11 +182,11 @@ public class DefaultLifecycleExecutor
if ( segment.aggregate() ) if ( segment.aggregate() )
{ {
if ( !rm.isBlackListed( project ) ) if ( !rm.isBlackListed( rootProject ) )
{ {
line(); line();
getLogger().info( "Building " + project.getName() ); getLogger().info( "Building " + rootProject.getName() );
getLogger().info( " " + segment ); getLogger().info( " " + segment );
@ -196,7 +196,7 @@ public class DefaultLifecycleExecutor
// Event monitoring. // Event monitoring.
String event = MavenEvents.PROJECT_EXECUTION; String event = MavenEvents.PROJECT_EXECUTION;
dispatcher.dispatchStart( event, project.getId() + " ( " + segment + " )" ); dispatcher.dispatchStart( event, rootProject.getId() + " ( " + segment + " )" );
try try
{ {
@ -207,23 +207,23 @@ public class DefaultLifecycleExecutor
try try
{ {
executeGoal( task, session, project ); executeGoal( task, session, rootProject );
} }
catch ( MojoExecutionException e ) catch ( MojoExecutionException e )
{ {
handleExecutionFailure( rm, project, e, task ); handleExecutionFailure( rm, rootProject, e, task );
} }
catch ( ArtifactResolutionException e ) catch ( ArtifactResolutionException e )
{ {
handleExecutionFailure( rm, project, e, task ); handleExecutionFailure( rm, rootProject, e, task );
} }
} }
dispatcher.dispatchEnd( event, project.getId() + " ( " + segment + " )" ); dispatcher.dispatchEnd( event, rootProject.getId() + " ( " + segment + " )" );
} }
catch ( LifecycleExecutionException e ) catch ( LifecycleExecutionException e )
{ {
dispatcher.dispatchError( event, project.getId() + " ( " + segment + " )", e ); dispatcher.dispatchError( event, rootProject.getId() + " ( " + segment + " )", e );
throw e; throw e;
} }
@ -232,7 +232,7 @@ public class DefaultLifecycleExecutor
{ {
line(); line();
getLogger().info( "SKIPPING " + project.getName() ); getLogger().info( "SKIPPING " + rootProject.getName() );
getLogger().info( " " + segment ); getLogger().info( " " + segment );
@ -279,11 +279,11 @@ public class DefaultLifecycleExecutor
} }
catch ( MojoExecutionException e ) catch ( MojoExecutionException e )
{ {
handleExecutionFailure( rm, project, e, task ); handleExecutionFailure( rm, currentProject, e, task );
} }
catch ( ArtifactResolutionException e ) catch ( ArtifactResolutionException e )
{ {
handleExecutionFailure( rm, project, e, task ); handleExecutionFailure( rm, currentProject, e, task );
} }
} }
@ -349,68 +349,17 @@ public class DefaultLifecycleExecutor
{ {
List segments = new ArrayList(); List segments = new ArrayList();
TaskSegment currentSegment = null; if ( project != null )
for ( Iterator it = tasks.iterator(); it.hasNext(); )
{ {
String task = (String) it.next();
// if it's a phase, then we don't need to check whether it's an aggregator. TaskSegment currentSegment = null;
// simply add it to the current task partition. for ( Iterator it = tasks.iterator(); it.hasNext(); )
if ( phases.contains( task ) )
{ {
if ( currentSegment != null && currentSegment.aggregate() ) String task = (String) it.next();
{
segments.add( currentSegment );
currentSegment = null;
}
if ( currentSegment == null ) // if it's a phase, then we don't need to check whether it's an aggregator.
{ // simply add it to the current task partition.
currentSegment = new TaskSegment(); if ( phases.contains( task ) )
}
currentSegment.add( task );
}
else
{
MojoDescriptor mojo = null;
try
{
// definitely a CLI goal, can use prefix
mojo = getMojoDescriptor( task, session, project, task, true );
}
catch ( LifecycleExecutionException e )
{
getLogger().info(
"Cannot find mojo descriptor for: \'" + task + "\' - Treating as non-aggregator." );
getLogger().debug( "", e );
}
catch ( ArtifactResolutionException e )
{
getLogger().info(
"Cannot find mojo descriptor for: \'" + task + "\' - Treating as non-aggregator." );
getLogger().debug( "", e );
}
// if the mojo descriptor was found, determine aggregator status according to:
// 1. whether the mojo declares itself an aggregator
// 2. whether the mojo DOES NOT require a project to function (implicitly avoid reactor)
if ( mojo != null && ( mojo.isAggregator() || !mojo.isProjectRequired() ) )
{
if ( currentSegment != null && !currentSegment.aggregate() )
{
segments.add( currentSegment );
currentSegment = null;
}
if ( currentSegment == null )
{
currentSegment = new TaskSegment( true );
}
currentSegment.add( task );
}
else
{ {
if ( currentSegment != null && currentSegment.aggregate() ) if ( currentSegment != null && currentSegment.aggregate() )
{ {
@ -425,11 +374,74 @@ public class DefaultLifecycleExecutor
currentSegment.add( task ); currentSegment.add( task );
} }
else
{
MojoDescriptor mojo = null;
try
{
// definitely a CLI goal, can use prefix
mojo = getMojoDescriptor( task, session, project, task, true );
}
catch ( LifecycleExecutionException e )
{
getLogger().info(
"Cannot find mojo descriptor for: \'" + task + "\' - Treating as non-aggregator." );
getLogger().debug( "", e );
}
catch ( ArtifactResolutionException e )
{
getLogger().info(
"Cannot find mojo descriptor for: \'" + task + "\' - Treating as non-aggregator." );
getLogger().debug( "", e );
}
// if the mojo descriptor was found, determine aggregator status according to:
// 1. whether the mojo declares itself an aggregator
// 2. whether the mojo DOES NOT require a project to function (implicitly avoid reactor)
if ( mojo != null && ( mojo.isAggregator() || !mojo.isProjectRequired() ) )
{
if ( currentSegment != null && !currentSegment.aggregate() )
{
segments.add( currentSegment );
currentSegment = null;
}
if ( currentSegment == null )
{
currentSegment = new TaskSegment( true );
}
currentSegment.add( task );
}
else
{
if ( currentSegment != null && currentSegment.aggregate() )
{
segments.add( currentSegment );
currentSegment = null;
}
if ( currentSegment == null )
{
currentSegment = new TaskSegment();
}
currentSegment.add( task );
}
}
}
segments.add( currentSegment );
}
else
{
TaskSegment segment = new TaskSegment( false );
for ( Iterator i = tasks.iterator(); i.hasNext(); )
{
segment.add( (String) i.next() );
} }
} }
segments.add( currentSegment );
return segments; return segments;
} }

View File

@ -141,11 +141,8 @@ public class DefaultPluginManager
{ {
// TODO: since this is only used in the lifecycle executor, maybe it should be moved there? There is no other // TODO: since this is only used in the lifecycle executor, maybe it should be moved there? There is no other
// use for the mapping manager in here // use for the mapping manager in here
Settings settings = session.getSettings(); return pluginMappingManager.getByPrefix( prefix, session.getSettings().getPluginGroups(),
List pluginGroups = settings.getPluginGroups(); project.getPluginArtifactRepositories(),
if ( pluginMappingManager == null ) throw new NullPointerException( "pluginMappingManager was null" );
if ( project == null ) throw new NullPointerException( "project was null" );
return pluginMappingManager.getByPrefix( prefix, pluginGroups, project.getPluginArtifactRepositories(),
session.getLocalRepository() ); session.getLocalRepository() );
} }