mirror of https://github.com/apache/maven.git
Revert "[MNG-7046] Revert MNG-5639 and make repo config static only"
This reverts commit 8c9c303f9c
.
This commit is contained in:
parent
9e19b57c72
commit
a5c68f7a4a
|
@ -93,8 +93,9 @@ public class ProjectModelResolver
|
|||
this.resolver = resolver;
|
||||
this.remoteRepositoryManager = remoteRepositoryManager;
|
||||
this.pomRepositories = new ArrayList<>();
|
||||
this.externalRepositories = repositories;
|
||||
this.repositories = repositories;
|
||||
this.externalRepositories = Collections.unmodifiableList( new ArrayList<>( repositories ) );
|
||||
this.repositories = new ArrayList<>();
|
||||
this.repositories.addAll( externalRepositories );
|
||||
this.repositoryMerging = repositoryMerging;
|
||||
this.repositoryIds = new HashSet<>();
|
||||
this.modelPool = modelPool;
|
||||
|
|
|
@ -192,6 +192,16 @@ public class DefaultMavenProjectBuilderTest
|
|||
assertNotNull( result.getDependencyResolutionResult() );
|
||||
}
|
||||
|
||||
public void testImportScopePomResolvesFromPropertyBasedRepository()
|
||||
throws Exception
|
||||
{
|
||||
File pomFile = getTestFile( "src/test/resources/projects/import-scope-pom-resolves-from-property-based-repository.xml" );
|
||||
ProjectBuildingRequest request = newBuildingRequest();
|
||||
request.setProcessPlugins( false );
|
||||
request.setResolveDependencies( true );
|
||||
projectBuilder.build( pomFile, request );
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests whether local version range parent references are build correctly.
|
||||
*
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>test</groupId>
|
||||
<artifactId>imported-pom-found</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
<repo.url>file:src/test/remote-repo</repo.url>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>central</id>
|
||||
<url>${repo.url}</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.its</groupId>
|
||||
<artifactId>a</artifactId>
|
||||
<version>0.1</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
</project>
|
|
@ -476,6 +476,9 @@ public class DefaultModelBuilder
|
|||
|
||||
result.setEffectiveModel( resultModel );
|
||||
|
||||
// Now the fully interpolated model is available: reconfigure the resolver
|
||||
configureResolver( request.getModelResolver(), resultModel, problems, true );
|
||||
|
||||
return resultModel;
|
||||
}
|
||||
|
||||
|
@ -806,6 +809,12 @@ public class DefaultModelBuilder
|
|||
}
|
||||
|
||||
private void configureResolver( ModelResolver modelResolver, Model model, DefaultModelProblemCollector problems )
|
||||
{
|
||||
configureResolver( modelResolver, model, problems, false );
|
||||
}
|
||||
|
||||
private void configureResolver( ModelResolver modelResolver, Model model, DefaultModelProblemCollector problems,
|
||||
boolean replaceRepositories )
|
||||
{
|
||||
if ( modelResolver == null )
|
||||
{
|
||||
|
@ -820,7 +829,7 @@ public class DefaultModelBuilder
|
|||
{
|
||||
try
|
||||
{
|
||||
modelResolver.addRepository( repository, false );
|
||||
modelResolver.addRepository( repository, replaceRepositories );
|
||||
}
|
||||
catch ( InvalidRepositoryException e )
|
||||
{
|
||||
|
|
|
@ -67,6 +67,8 @@ class DefaultModelResolver
|
|||
|
||||
private List<RemoteRepository> repositories;
|
||||
|
||||
private final List<RemoteRepository> externalRepositories;
|
||||
|
||||
private final ArtifactResolver resolver;
|
||||
|
||||
private final VersionRangeResolver versionRangeResolver;
|
||||
|
@ -86,6 +88,7 @@ class DefaultModelResolver
|
|||
this.versionRangeResolver = versionRangeResolver;
|
||||
this.remoteRepositoryManager = remoteRepositoryManager;
|
||||
this.repositories = repositories;
|
||||
this.externalRepositories = Collections.unmodifiableList( new ArrayList<>( repositories ) );
|
||||
|
||||
this.repositoryIds = new HashSet<>();
|
||||
}
|
||||
|
@ -99,6 +102,7 @@ class DefaultModelResolver
|
|||
this.versionRangeResolver = original.versionRangeResolver;
|
||||
this.remoteRepositoryManager = original.remoteRepositoryManager;
|
||||
this.repositories = new ArrayList<>( original.repositories );
|
||||
this.externalRepositories = original.externalRepositories;
|
||||
this.repositoryIds = new HashSet<>();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue