MNG-5312: MavenProject.getParent intolerably slow when import scope used heavily

Submitted by: Jesse Glick


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@1362736 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2012-07-18 01:16:59 +00:00
parent 94fde61ad2
commit e778ea6712
1 changed files with 6 additions and 11 deletions

View File

@ -99,13 +99,13 @@ public class DefaultProjectBuilder
public ProjectBuildingResult build( File pomFile, ProjectBuildingRequest request ) public ProjectBuildingResult build( File pomFile, ProjectBuildingRequest request )
throws ProjectBuildingException throws ProjectBuildingException
{ {
return build( pomFile, new FileModelSource( pomFile ), new InternalConfig( request, null, null ) ); return build( pomFile, new FileModelSource( pomFile ), new InternalConfig( request, null ) );
} }
public ProjectBuildingResult build( ModelSource modelSource, ProjectBuildingRequest request ) public ProjectBuildingResult build( ModelSource modelSource, ProjectBuildingRequest request )
throws ProjectBuildingException throws ProjectBuildingException
{ {
return build( null, modelSource, new InternalConfig( request, null, null ) ); return build( null, modelSource, new InternalConfig( request, null ) );
} }
private ProjectBuildingResult build( File pomFile, ModelSource modelSource, InternalConfig config ) private ProjectBuildingResult build( File pomFile, ModelSource modelSource, InternalConfig config )
@ -256,7 +256,7 @@ public class DefaultProjectBuilder
request.setUserProperties( configuration.getUserProperties() ); request.setUserProperties( configuration.getUserProperties() );
request.setBuildStartTime( configuration.getBuildStartTime() ); request.setBuildStartTime( configuration.getBuildStartTime() );
request.setModelResolver( resolver ); request.setModelResolver( resolver );
request.setModelCache( config.modelCache ); request.setModelCache( new ReactorModelCache() );
return request; return request;
} }
@ -273,7 +273,7 @@ public class DefaultProjectBuilder
org.sonatype.aether.artifact.Artifact pomArtifact = RepositoryUtils.toArtifact( artifact ); org.sonatype.aether.artifact.Artifact pomArtifact = RepositoryUtils.toArtifact( artifact );
pomArtifact = ArtifactDescriptorUtils.toPomArtifact( pomArtifact ); pomArtifact = ArtifactDescriptorUtils.toPomArtifact( pomArtifact );
InternalConfig config = new InternalConfig( request, null, null ); InternalConfig config = new InternalConfig( request, null );
boolean localProject; boolean localProject;
@ -334,9 +334,7 @@ public class DefaultProjectBuilder
ReactorModelPool modelPool = new ReactorModelPool(); ReactorModelPool modelPool = new ReactorModelPool();
ReactorModelCache modelCache = new ReactorModelCache(); InternalConfig config = new InternalConfig( request, modelPool );
InternalConfig config = new InternalConfig( request, modelPool, modelCache );
Map<String, MavenProject> projectIndex = new HashMap<String, MavenProject>( 256 ); Map<String, MavenProject> projectIndex = new HashMap<String, MavenProject>( 256 );
@ -673,13 +671,10 @@ public class DefaultProjectBuilder
public final ReactorModelPool modelPool; public final ReactorModelPool modelPool;
public final ReactorModelCache modelCache; InternalConfig( ProjectBuildingRequest request, ReactorModelPool modelPool )
public InternalConfig( ProjectBuildingRequest request, ReactorModelPool modelPool, ReactorModelCache modelCache )
{ {
this.request = request; this.request = request;
this.modelPool = modelPool; this.modelPool = modelPool;
this.modelCache = modelCache;
session = session =
LegacyLocalRepositoryManager.overlay( request.getLocalRepository(), request.getRepositorySession(), LegacyLocalRepositoryManager.overlay( request.getLocalRepository(), request.getRepositorySession(),
repoSystem ); repoSystem );