[MNG-7402] BuildListCalculator never detaches the classloader

This closes #683
This commit is contained in:
Christoph Läubrich 2022-02-25 11:46:07 +01:00 committed by Michael Osipov
parent 69d6c6d5a2
commit e327be3d85
1 changed files with 12 additions and 4 deletions

View File

@ -60,10 +60,18 @@ public class BuildListCalculator
}
for ( MavenProject project : projects )
{
BuilderCommon.attachToThread( project ); // Not totally sure if this is needed for anything
MavenSession copiedSession = session.clone();
copiedSession.setCurrentProject( project );
projectBuilds.add( new ProjectSegment( project, taskSegment, copiedSession ) );
ClassLoader tccl = Thread.currentThread().getContextClassLoader();
try
{
BuilderCommon.attachToThread( project ); // Not totally sure if this is needed for anything
MavenSession copiedSession = session.clone();
copiedSession.setCurrentProject( project );
projectBuilds.add( new ProjectSegment( project, taskSegment, copiedSession ) );
}
finally
{
Thread.currentThread().setContextClassLoader( tccl );
}
}
}
return new ProjectBuildList( projectBuilds );