mirror of
https://github.com/apache/maven.git
synced 2025-02-13 05:26:25 +00:00
extract AbstractMavenLifecycleParticipant dispatch methods
This commit is contained in:
parent
441cf73c06
commit
9b5b8d4082
@ -227,12 +227,7 @@ private MavenExecutionResult doExecute( MavenExecutionRequest request, MavenSess
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// CHECKSTYLE_OFF: LineLength
|
afterSessionStart( session );
|
||||||
for ( AbstractMavenLifecycleParticipant listener : getLifecycleParticipants( Collections.<MavenProject>emptyList() ) )
|
|
||||||
{
|
|
||||||
listener.afterSessionStart( session );
|
|
||||||
}
|
|
||||||
// CHECKSTYLE_ON: LineLength
|
|
||||||
}
|
}
|
||||||
catch ( MavenExecutionException e )
|
catch ( MavenExecutionException e )
|
||||||
{
|
{
|
||||||
@ -279,24 +274,14 @@ private MavenExecutionResult doExecute( MavenExecutionRequest request, MavenSess
|
|||||||
|
|
||||||
repoSession.setReadOnly();
|
repoSession.setReadOnly();
|
||||||
|
|
||||||
ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
for ( AbstractMavenLifecycleParticipant listener : getLifecycleParticipants( session.getProjects() ) )
|
afterProjectsRead( session );
|
||||||
{
|
|
||||||
Thread.currentThread().setContextClassLoader( listener.getClass().getClassLoader() );
|
|
||||||
|
|
||||||
listener.afterProjectsRead( session );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch ( MavenExecutionException e )
|
catch ( MavenExecutionException e )
|
||||||
{
|
{
|
||||||
return addExceptionToResult( result, e );
|
return addExceptionToResult( result, e );
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
Thread.currentThread().setContextClassLoader( originalClassLoader );
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// The projects need to be topologically after the participants have run their afterProjectsRead(session)
|
// The projects need to be topologically after the participants have run their afterProjectsRead(session)
|
||||||
@ -368,6 +353,36 @@ private MavenExecutionResult doExecute( MavenExecutionRequest request, MavenSess
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void afterSessionStart( MavenSession session )
|
||||||
|
throws MavenExecutionException
|
||||||
|
{
|
||||||
|
// CHECKSTYLE_OFF: LineLength
|
||||||
|
for ( AbstractMavenLifecycleParticipant listener : getLifecycleParticipants( Collections.<MavenProject>emptyList() ) )
|
||||||
|
// CHECKSTYLE_ON: LineLength
|
||||||
|
{
|
||||||
|
listener.afterSessionStart( session );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void afterProjectsRead( MavenSession session )
|
||||||
|
throws MavenExecutionException
|
||||||
|
{
|
||||||
|
ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
for ( AbstractMavenLifecycleParticipant listener : getLifecycleParticipants( session.getProjects() ) )
|
||||||
|
{
|
||||||
|
Thread.currentThread().setContextClassLoader( listener.getClass().getClassLoader() );
|
||||||
|
|
||||||
|
listener.afterProjectsRead( session );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Thread.currentThread().setContextClassLoader( originalClassLoader );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void afterSessionEnd( Collection<MavenProject> projects, MavenSession session )
|
private void afterSessionEnd( Collection<MavenProject> projects, MavenSession session )
|
||||||
throws MavenExecutionException
|
throws MavenExecutionException
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user