mirror of https://github.com/apache/maven.git
Make sure participants and session scope exit are called
Even in case of failing build. Signed-off-by: Jason van Zyl <jason@tesla.io>
This commit is contained in:
parent
73d35ba959
commit
18964baa25
|
@ -336,7 +336,31 @@ public class DefaultMaven
|
||||||
//
|
//
|
||||||
projectDependencyGraph = createProjectDependencyGraph( session.getProjects(), request, result, false );
|
projectDependencyGraph = createProjectDependencyGraph( session.getProjects(), request, result, false );
|
||||||
|
|
||||||
if ( result.hasExceptions() )
|
try
|
||||||
|
{
|
||||||
|
if ( result.hasExceptions() )
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
session.setProjects( projectDependencyGraph.getSortedProjects() );
|
||||||
|
|
||||||
|
session.setProjectDependencyGraph( projectDependencyGraph );
|
||||||
|
|
||||||
|
result.setTopologicallySortedProjects( session.getProjects() );
|
||||||
|
|
||||||
|
result.setProject( session.getTopLevelProject() );
|
||||||
|
|
||||||
|
lifecycleStarter.execute( session );
|
||||||
|
|
||||||
|
validateActivatedProfiles( session.getProjects(), request.getActiveProfiles() );
|
||||||
|
|
||||||
|
if ( session.getResult().hasExceptions() )
|
||||||
|
{
|
||||||
|
return addExceptionToResult( result, session.getResult().getExceptions().get( 0 ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -346,38 +370,12 @@ public class DefaultMaven
|
||||||
{
|
{
|
||||||
return addExceptionToResult( result, e );
|
return addExceptionToResult( result, e );
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
return result;
|
{
|
||||||
|
sessionScope.exit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
session.setProjects( projectDependencyGraph.getSortedProjects() );
|
|
||||||
|
|
||||||
session.setProjectDependencyGraph( projectDependencyGraph );
|
|
||||||
|
|
||||||
result.setTopologicallySortedProjects( session.getProjects() );
|
|
||||||
|
|
||||||
result.setProject( session.getTopLevelProject() );
|
|
||||||
|
|
||||||
lifecycleStarter.execute( session );
|
|
||||||
|
|
||||||
validateActivatedProfiles( session.getProjects(), request.getActiveProfiles() );
|
|
||||||
|
|
||||||
if ( session.getResult().hasExceptions() )
|
|
||||||
{
|
|
||||||
return addExceptionToResult( result, session.getResult().getExceptions().get( 0 ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
afterSessionEnd( projects, session );
|
|
||||||
}
|
|
||||||
catch ( MavenExecutionException e )
|
|
||||||
{
|
|
||||||
return addExceptionToResult( result, e );
|
|
||||||
}
|
|
||||||
|
|
||||||
sessionScope.exit();
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue