ProjectSegment projectBuild, Schedule scheduleOfNext )
throws InterruptedException
{
for ( MavenProject upstreamProject : projectBuild.getImmediateUpstreamProjects() )
{
final MavenExecutionPlan upstreamPlan = executionPlans.get( upstreamProject );
final String nextPhase = scheduleOfNext != null && scheduleOfNext.hasUpstreamPhaseDefined()
? scheduleOfNext.getUpstreamPhase()
: nextPlanItem.getLifecyclePhase();
final ExecutionPlanItem upstream = upstreamPlan.findLastInPhase( nextPhase );
if ( upstream != null )
{
long startWait = System.currentTimeMillis();
upstream.waitUntilDone();
builtLogItem.addWait( upstreamProject, upstream, startWait );
}
else if ( !upstreamPlan.containsPhase( nextPhase ) )
{
// Still a bit of a kludge; if we cannot connect in a sensible way to
// the upstream build plan we just revert to waiting for it all to
// complete. Real problem is per-mojo phase->lifecycle mapping
builtLogItem.addDependency( upstreamProject, "No phase tracking possible " );
upstreamPlan.waitUntilAllDone();
}
else
{
builtLogItem.addDependency( upstreamProject, "No schedule" );
}