From a3eba702af6c9d7e0a0acb4f1d44e3b421c669b5 Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Tue, 25 Aug 2009 08:58:18 +0000 Subject: [PATCH] [MNG-4318] MavenProject.executionRoot is not set correctly git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@807526 13f79535-47bb-0310-9956-ffa450edef68 --- .../maven/project/DefaultProjectBuilder.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 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 ae608222c4..e589075955 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 @@ -293,7 +293,8 @@ public class DefaultProjectBuilder ReactorModelCache modelCache = new ReactorModelCache(); - boolean errors = build( results, interimResults, pomFiles, recursive, config, reactorModelPool, modelCache ); + boolean errors = + build( results, interimResults, pomFiles, true, recursive, config, reactorModelPool, modelCache ); for ( InterimResult interimResult : interimResults ) { @@ -312,6 +313,7 @@ public class DefaultProjectBuilder ModelBuildingResult result = modelBuilder.build( interimResult.request, interimResult.result ); MavenProject project = toProject( result, config, interimResult.listener ); + project.setExecutionRoot( interimResult.root ); results.add( new DefaultProjectBuildingResult( project, result.getProblems(), null ) ); } @@ -338,7 +340,7 @@ public class DefaultProjectBuilder } private boolean build( List results, List interimResults, - List pomFiles, boolean recursive, ProjectBuildingRequest config, + List pomFiles, boolean isRoot, boolean recursive, ProjectBuildingRequest config, ReactorModelPool reactorModelPool, ReactorModelCache modelCache ) { boolean errors = false; @@ -360,7 +362,7 @@ public class DefaultProjectBuilder Model model = result.getEffectiveModel(); - interimResults.add( new InterimResult( pomFile, request, result, listener ) ); + interimResults.add( new InterimResult( pomFile, request, result, listener, isRoot ) ); if ( recursive && !model.getModules().isEmpty() ) { @@ -414,9 +416,11 @@ public class DefaultProjectBuilder moduleFiles.add( moduleFile ); } - errors = - build( results, interimResults, moduleFiles, recursive, config, reactorModelPool, modelCache ) - || errors; + if ( build( results, interimResults, moduleFiles, false, recursive, config, reactorModelPool, + modelCache ) ) + { + errors = true; + } } } catch ( ModelBuildingException e ) @@ -441,13 +445,16 @@ public class DefaultProjectBuilder DefaultModelBuildingListener listener; + boolean root; + InterimResult( File pomFile, ModelBuildingRequest request, ModelBuildingResult result, - DefaultModelBuildingListener listener ) + DefaultModelBuildingListener listener, boolean root ) { this.pomFile = pomFile; this.request = request; this.result = result; this.listener = listener; + this.root = root; } }