From 37a0e64aa0c5b6af4155c8fef015cf952c7e9354 Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Tue, 6 Apr 2010 11:00:19 +0000 Subject: [PATCH] [MNG-4618] maven-javadoc-plugin aggregate-jar fails with maven3 and multiple modules git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@931086 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/maven/execution/MavenSession.java | 18 +++++++++++++++--- .../maven/project/DefaultProjectBuilder.java | 10 ++++------ 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java b/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java index 3489534143..115d6627e7 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java +++ b/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java @@ -124,11 +124,23 @@ public class MavenSession public void setProjects( List projects ) { - //TODO: Current for testing classes creating the session - if ( projects.size() > 0 ) + if ( !projects.isEmpty() ) { this.currentProject = projects.get( 0 ); - this.topLevelProject = projects.get( 0 ); + this.topLevelProject = currentProject; + for ( MavenProject project : projects ) + { + if ( project.isExecutionRoot() ) + { + topLevelProject = project; + break; + } + } + } + else + { + this.currentProject = null; + this.topLevelProject = null; } this.projects = projects; } 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 fafc6b224e..c6b367d3e4 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 @@ -451,18 +451,16 @@ public class DefaultProjectBuilder MavenProject project = interimResult.listener.getProject(); initProject( project, result ); - projects.add( project ); - - results.add( new DefaultProjectBuildingResult( project, result.getProblems(), null ) ); - - project.setExecutionRoot( interimResult.root ); - List modules = new ArrayList(); noErrors = build( results, modules, interimResult.modules, config ) && noErrors; projects.addAll( modules ); + projects.add( project ); + project.setExecutionRoot( interimResult.root ); project.setCollectedProjects( modules ); + + results.add( new DefaultProjectBuildingResult( project, result.getProblems(), null ) ); } catch ( ModelBuildingException e ) {