This is an automated email from the ASF dual-hosted git repository. michaelo pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven.git
The following commit(s) were added to refs/heads/master by this push: new e327be3 [MNG-7402] BuildListCalculator never detaches the classloader e327be3 is described below commit e327be3d85918a23a5ba48d752143a6dbf8b83f7 Author: Christoph Läubrich <christ...@laeubi-soft.de> AuthorDate: Fri Feb 25 11:46:07 2022 +0100 [MNG-7402] BuildListCalculator never detaches the classloader This closes #683 --- .../maven/lifecycle/internal/BuildListCalculator.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuildListCalculator.java b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuildListCalculator.java index 9000c93..c35ac41 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuildListCalculator.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuildListCalculator.java @@ -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 );