mirror of https://github.com/apache/maven.git
PR: MNG-208
flag project that was the root of execution git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@291236 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
bb95d2c1cc
commit
3e264f80ba
|
@ -160,7 +160,7 @@ public class DefaultMaven
|
||||||
List files = getProjectFiles( request );
|
List files = getProjectFiles( request );
|
||||||
|
|
||||||
List projects = collectProjects( files, request.getLocalRepository(), request.isRecursive(),
|
List projects = collectProjects( files, request.getLocalRepository(), request.isRecursive(),
|
||||||
request.getSettings(), globalProfileManager );
|
request.getSettings(), globalProfileManager, !request.isReactorActive() );
|
||||||
|
|
||||||
// the reasoning here is that the list is still unsorted according to dependency, so the first project
|
// the reasoning here is that the list is still unsorted according to dependency, so the first project
|
||||||
// SHOULD BE the top-level, or the one we want to start with if we're doing an aggregated build.
|
// SHOULD BE the top-level, or the one we want to start with if we're doing an aggregated build.
|
||||||
|
@ -351,7 +351,7 @@ public class DefaultMaven
|
||||||
}
|
}
|
||||||
|
|
||||||
private List collectProjects( List files, ArtifactRepository localRepository, boolean recursive, Settings settings,
|
private List collectProjects( List files, ArtifactRepository localRepository, boolean recursive, Settings settings,
|
||||||
ProfileManager globalProfileManager )
|
ProfileManager globalProfileManager, boolean isRoot )
|
||||||
throws ProjectBuildingException, ReactorException, IOException, ArtifactResolutionException,
|
throws ProjectBuildingException, ReactorException, IOException, ArtifactResolutionException,
|
||||||
ProfileActivationException
|
ProfileActivationException
|
||||||
{
|
{
|
||||||
|
@ -371,6 +371,11 @@ public class DefaultMaven
|
||||||
|
|
||||||
MavenProject project = getProject( file, localRepository, settings, globalProfileManager );
|
MavenProject project = getProject( file, localRepository, settings, globalProfileManager );
|
||||||
|
|
||||||
|
if ( isRoot )
|
||||||
|
{
|
||||||
|
project.setExecutionRoot( true );
|
||||||
|
}
|
||||||
|
|
||||||
if ( project.getPrerequisites() != null && project.getPrerequisites().getMaven() != null )
|
if ( project.getPrerequisites() != null && project.getPrerequisites().getMaven() != null )
|
||||||
{
|
{
|
||||||
DefaultArtifactVersion version = new DefaultArtifactVersion( project.getPrerequisites().getMaven() );
|
DefaultArtifactVersion version = new DefaultArtifactVersion( project.getPrerequisites().getMaven() );
|
||||||
|
@ -409,7 +414,7 @@ public class DefaultMaven
|
||||||
}
|
}
|
||||||
|
|
||||||
List collectedProjects = collectProjects( moduleFiles, localRepository, recursive, settings,
|
List collectedProjects = collectProjects( moduleFiles, localRepository, recursive, settings,
|
||||||
globalProfileManager );
|
globalProfileManager, false );
|
||||||
projects.addAll( collectedProjects );
|
projects.addAll( collectedProjects );
|
||||||
project.setCollectedProjects( collectedProjects );
|
project.setCollectedProjects( collectedProjects );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1167,6 +1167,8 @@ public class DefaultMavenProjectBuilder
|
||||||
|
|
||||||
project = processProjectLogic( "<Super-POM>", project, remoteRepositories, null, null );
|
project = processProjectLogic( "<Super-POM>", project, remoteRepositories, null, null );
|
||||||
|
|
||||||
|
project.setExecutionRoot( true );
|
||||||
|
|
||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
catch ( ModelInterpolationException e )
|
catch ( ModelInterpolationException e )
|
||||||
|
|
|
@ -134,6 +134,8 @@ public class MavenProject
|
||||||
|
|
||||||
private Build buildOverlay;
|
private Build buildOverlay;
|
||||||
|
|
||||||
|
private boolean executionRoot;
|
||||||
|
|
||||||
public MavenProject( Model model )
|
public MavenProject( Model model )
|
||||||
{
|
{
|
||||||
this.model = model;
|
this.model = model;
|
||||||
|
@ -181,6 +183,8 @@ public class MavenProject
|
||||||
this.originalModel = ModelUtils.cloneModel( project.originalModel );
|
this.originalModel = ModelUtils.cloneModel( project.originalModel );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.executionRoot = project.executionRoot;
|
||||||
|
|
||||||
// TODO: need to clone this too?
|
// TODO: need to clone this too?
|
||||||
this.artifact = project.artifact;
|
this.artifact = project.artifact;
|
||||||
}
|
}
|
||||||
|
@ -1449,4 +1453,14 @@ public class MavenProject
|
||||||
{
|
{
|
||||||
return projectReferences;
|
return projectReferences;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isExecutionRoot()
|
||||||
|
{
|
||||||
|
return executionRoot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExecutionRoot( boolean executionRoot )
|
||||||
|
{
|
||||||
|
this.executionRoot = executionRoot;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,11 +169,14 @@ public class ProjectSorter
|
||||||
{
|
{
|
||||||
if ( topLevelProject == null )
|
if ( topLevelProject == null )
|
||||||
{
|
{
|
||||||
List projectsByFile = new ArrayList( sortedProjects );
|
for ( Iterator i = sortedProjects.iterator(); i.hasNext() && topLevelProject == null; )
|
||||||
|
{
|
||||||
Collections.sort( projectsByFile, new ByProjectFileComparator() );
|
MavenProject project = (MavenProject) i.next();
|
||||||
|
if ( project.isExecutionRoot() )
|
||||||
topLevelProject = (MavenProject) projectsByFile.get( 0 );
|
{
|
||||||
|
topLevelProject = project;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return topLevelProject;
|
return topLevelProject;
|
||||||
|
|
Loading…
Reference in New Issue