o Refactored code

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@933001 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2010-04-11 22:15:17 +00:00
parent 91e83d2424
commit e171aa5e0d
1 changed files with 14 additions and 6 deletions

View File

@ -68,7 +68,6 @@ public class MojoExecutor
{
execute( session, mojoExecution, projectIndex, dependencyContext, phaseRecorder );
}
}
public void execute( MavenSession session, MojoExecution mojoExecution, ProjectIndex projectIndex,
@ -214,9 +213,11 @@ public class MojoExecutor
{
for ( Map.Entry<String, List<MojoExecution>> fork : forkedExecutions.entrySet() )
{
int index = projectIndex.getIndices().get( fork.getKey() );
String projectId = fork.getKey();
MavenProject forkedProject = projectIndex.getProjects().get( fork.getKey() );
int index = projectIndex.getIndices().get( projectId );
MavenProject forkedProject = projectIndex.getProjects().get( projectId );
forkedProjects.add( forkedProject );
@ -224,15 +225,22 @@ public class MojoExecutor
forkedProject.setExecutionProject( executedProject );
List<MojoExecution> mojoExecutions = fork.getValue();
if ( mojoExecutions.isEmpty() )
{
continue;
}
try
{
session.setCurrentProject( executedProject );
session.getProjects().set( index, executedProject );
projectIndex.getProjects().put( fork.getKey(), executedProject );
projectIndex.getProjects().put( projectId, executedProject );
eventCatapult.fire( ExecutionEvent.Type.ForkedProjectStarted, session, mojoExecution );
execute( session, fork.getValue(), projectIndex, dependencyContext );
execute( session, mojoExecutions, projectIndex, dependencyContext );
eventCatapult.fire( ExecutionEvent.Type.ForkedProjectSucceeded, session, mojoExecution );
}
@ -244,7 +252,7 @@ public class MojoExecutor
}
finally
{
projectIndex.getProjects().put( fork.getKey(), forkedProject );
projectIndex.getProjects().put( projectId, forkedProject );
session.getProjects().set( index, forkedProject );
session.setCurrentProject( project );
}