Accumulate remote repositories when scanning for extensions, down the model lineage, starting with the original remote repositories passed in from outside.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@549968 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2007-06-22 22:02:10 +00:00
parent 99ba1e7e85
commit fda3badc24
1 changed files with 12 additions and 3 deletions

View File

@ -90,7 +90,7 @@ public class DefaultBuildExtensionScanner
scanInternal( pom, localRepository, globalProfileManager, new ArrayList(), Collections.singletonList( pom ) ); scanInternal( pom, localRepository, globalProfileManager, new ArrayList(), Collections.singletonList( pom ) );
} }
// TODO: Use a build-context cache object for visitedModelIdx and reactorFiles, // TODO: Use a build-context cache object for visitedModelIdx and reactorFiles,
// once we move to just-in-time project scanning. // once we move to just-in-time project scanning.
private void scanInternal( File pom, ArtifactRepository localRepository, ProfileManager globalProfileManager, private void scanInternal( File pom, ArtifactRepository localRepository, ProfileManager globalProfileManager,
List visitedModelIds, List reactorFiles ) List visitedModelIds, List reactorFiles )
@ -114,11 +114,20 @@ public class DefaultBuildExtensionScanner
Map inheritedInterpolationValues = new HashMap(); Map inheritedInterpolationValues = new HashMap();
List inheritedRemoteRepositories = new ArrayList();
inheritedRemoteRepositories.addAll( originalRemoteRepositories );
for ( ModelLineageIterator lineageIterator = lineage.reversedLineageIterator(); lineageIterator.hasNext(); ) for ( ModelLineageIterator lineageIterator = lineage.reversedLineageIterator(); lineageIterator.hasNext(); )
{ {
Model model = (Model) lineageIterator.next(); Model model = (Model) lineageIterator.next();
File modelPom = lineageIterator.getPOMFile(); File modelPom = lineageIterator.getPOMFile();
List remoteRepos = lineageIterator.getArtifactRepositories();
if ( ( remoteRepos != null ) && !remoteRepos.isEmpty() )
{
inheritedRemoteRepositories.addAll( remoteRepos );
}
String key = createKey( model ); String key = createKey( model );
if ( visitedModelIds.contains( key ) ) if ( visitedModelIds.contains( key ) )
@ -140,7 +149,7 @@ public class DefaultBuildExtensionScanner
model = modelInterpolator.interpolate( model, inheritedInterpolationValues, false ); model = modelInterpolator.interpolate( model, inheritedInterpolationValues, false );
checkModelBuildForExtensions( model, localRepository, lineageIterator.getArtifactRepositories() ); checkModelBuildForExtensions( model, localRepository, inheritedRemoteRepositories );
if ( !reactorFiles.contains( modelPom ) ) if ( !reactorFiles.contains( modelPom ) )
{ {
@ -274,7 +283,7 @@ public class DefaultBuildExtensionScanner
{ {
List extensions = build.getExtensions(); List extensions = build.getExtensions();
if ( extensions != null && !extensions.isEmpty() ) if ( ( extensions != null ) && !extensions.isEmpty() )
{ {
// thankfully, we don't have to deal with dependencyManagement here, yet. // thankfully, we don't have to deal with dependencyManagement here, yet.
// TODO Revisit if/when extensions are made to use the info in dependencyManagement // TODO Revisit if/when extensions are made to use the info in dependencyManagement