diff --git a/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java b/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java index 4cfed8ae3d..66dee8aab4 100644 --- a/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java +++ b/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java @@ -276,8 +276,8 @@ public class DefaultMavenProjectBuilder modelCache.put( createCacheKey( model.getGroupId(), model.getArtifactId(), model.getVersion() ), model ); MavenProject project = build( projectDescriptor.getAbsolutePath(), model, localRepository, - Collections.EMPTY_LIST, projectDescriptor.getAbsoluteFile().getParentFile(), - profileManager ); + buildArtifactRepositories( getSuperModel() ), + projectDescriptor.getAbsoluteFile().getParentFile(), profileManager ); if ( project.getDistributionManagement() != null && project.getDistributionManagement().getStatus() != null ) { @@ -508,8 +508,7 @@ public class DefaultMavenProjectBuilder // only add the super repository if it wasn't overridden by a profile or project List repositories = new ArrayList( aggregatedRemoteWagonRepositories ); - List superRepositories = ProjectUtils.buildArtifactRepositories( superModel.getRepositories(), - artifactRepositoryFactory, container ); + List superRepositories = buildArtifactRepositories( superModel ); for ( Iterator i = superRepositories.iterator(); i.hasNext(); ) { ArtifactRepository repository = (ArtifactRepository) i.next(); @@ -533,6 +532,12 @@ public class DefaultMavenProjectBuilder return project; } + private List buildArtifactRepositories( Model model ) + throws ProjectBuildingException + { + return ProjectUtils.buildArtifactRepositories( model.getRepositories(), artifactRepositoryFactory, container ); + } + /** * @todo can this take in a model instead of a project and still be successful? * @todo In fact, does project REALLY need a MavenProject as a parent? Couldn't it have just a wrapper around a @@ -664,8 +669,7 @@ public class DefaultMavenProjectBuilder { if ( !model.getRepositories().isEmpty() ) { - List respositories = ProjectUtils.buildArtifactRepositories( model.getRepositories(), - artifactRepositoryFactory, container ); + List respositories = buildArtifactRepositories( model ); for ( Iterator it = respositories.iterator(); it.hasNext(); ) { @@ -1114,8 +1118,7 @@ public class DefaultMavenProjectBuilder { project.setFile( new File( ".", "pom.xml" ) ); - List remoteRepositories = ProjectUtils.buildArtifactRepositories( superModel.getRepositories(), - artifactRepositoryFactory, container ); + List remoteRepositories = buildArtifactRepositories( superModel ); project = processProjectLogic( "", project, remoteRepositories, null );