From e3f77105781b07e074c3c4781826c90a4059dd72 Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Mon, 27 Jul 2009 17:23:21 +0000 Subject: [PATCH] o Fixed TCCL handling git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@798226 13f79535-47bb-0310-9956-ffa450edef68 --- .../maven/project/DefaultProjectBuilder.java | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java b/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java index beaa4139c9..8604d33854 100644 --- a/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java +++ b/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java @@ -309,23 +309,32 @@ public class DefaultProjectBuilder reactorModelPool.put( model.getGroupId(), model.getArtifactId(), model.getVersion(), model.getPomFile() ); } - for ( InterimResult interimResult : interimResults ) + ClassLoader oldContextClassLoader = Thread.currentThread().getContextClassLoader(); + + try { - try + for ( InterimResult interimResult : interimResults ) { - ModelBuildingResult result = modelBuilder.build( interimResult.request, interimResult.result ); + try + { + ModelBuildingResult result = modelBuilder.build( interimResult.request, interimResult.result ); - MavenProject project = toProject( result, config, interimResult.listener ); + MavenProject project = toProject( result, config, interimResult.listener ); - results.add( new DefaultProjectBuildingResult( project, result.getProblems() ) ); - } - catch ( ModelBuildingException e ) - { - results.add( new DefaultProjectBuildingResult( interimResult.pomFile, e.getProblems() ) ); - - errors = true; + results.add( new DefaultProjectBuildingResult( project, result.getProblems() ) ); + } + catch ( ModelBuildingException e ) + { + results.add( new DefaultProjectBuildingResult( interimResult.pomFile, e.getProblems() ) ); + + errors = true; + } } } + finally + { + Thread.currentThread().setContextClassLoader( oldContextClassLoader ); + } if ( errors ) {