[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 395411fe31
commit d29af9018b
1 changed files with 12 additions and 4 deletions

View File

@ -57,10 +57,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 );