From fda3badc24608473a1a8052d6bea71344cfce6d5 Mon Sep 17 00:00:00 2001 From: John Dennis Casey Date: Fri, 22 Jun 2007 22:02:10 +0000 Subject: [PATCH] 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 --- .../extension/DefaultBuildExtensionScanner.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/extension/DefaultBuildExtensionScanner.java b/maven-core/src/main/java/org/apache/maven/extension/DefaultBuildExtensionScanner.java index d86a2195c9..64b8d3fdaa 100644 --- a/maven-core/src/main/java/org/apache/maven/extension/DefaultBuildExtensionScanner.java +++ b/maven-core/src/main/java/org/apache/maven/extension/DefaultBuildExtensionScanner.java @@ -90,7 +90,7 @@ public class DefaultBuildExtensionScanner 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. private void scanInternal( File pom, ArtifactRepository localRepository, ProfileManager globalProfileManager, List visitedModelIds, List reactorFiles ) @@ -114,11 +114,20 @@ public class DefaultBuildExtensionScanner Map inheritedInterpolationValues = new HashMap(); + List inheritedRemoteRepositories = new ArrayList(); + inheritedRemoteRepositories.addAll( originalRemoteRepositories ); + for ( ModelLineageIterator lineageIterator = lineage.reversedLineageIterator(); lineageIterator.hasNext(); ) { Model model = (Model) lineageIterator.next(); File modelPom = lineageIterator.getPOMFile(); + List remoteRepos = lineageIterator.getArtifactRepositories(); + if ( ( remoteRepos != null ) && !remoteRepos.isEmpty() ) + { + inheritedRemoteRepositories.addAll( remoteRepos ); + } + String key = createKey( model ); if ( visitedModelIds.contains( key ) ) @@ -140,7 +149,7 @@ public class DefaultBuildExtensionScanner model = modelInterpolator.interpolate( model, inheritedInterpolationValues, false ); - checkModelBuildForExtensions( model, localRepository, lineageIterator.getArtifactRepositories() ); + checkModelBuildForExtensions( model, localRepository, inheritedRemoteRepositories ); if ( !reactorFiles.contains( modelPom ) ) { @@ -274,7 +283,7 @@ public class DefaultBuildExtensionScanner { 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. // TODO Revisit if/when extensions are made to use the info in dependencyManagement