Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MNG-4347] import-scoped dependencies of direct dependencies are not resolved using profile modifications from settings.xml #159

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ public class ProjectModelResolver

private final List<RemoteRepository> externalRepositories;

private final Set<String> externalRepositoryIds;

private final RepositorySystem resolver;

private final RemoteRepositoryManager remoteRepositoryManager;
Expand Down Expand Up @@ -98,6 +100,12 @@ public ProjectModelResolver( RepositorySystemSession session, RequestTrace trace
this.repositories.addAll( externalRepositories );
this.repositoryMerging = repositoryMerging;
this.repositoryIds = new HashSet<>();
this.externalRepositoryIds = new HashSet<>();
for ( final RemoteRepository repository : this.repositories )
{
this.repositoryIds.add( repository.getId() );
this.externalRepositoryIds.add( repository.getId() );
}
this.modelPool = modelPool;
}

Expand All @@ -112,6 +120,7 @@ private ProjectModelResolver( ProjectModelResolver original )
this.repositories = new ArrayList<>( original.repositories );
this.repositoryMerging = original.repositoryMerging;
this.repositoryIds = new HashSet<>( original.repositoryIds );
this.externalRepositoryIds = new HashSet<>( original.externalRepositoryIds );
this.modelPool = original.modelPool;
}

Expand All @@ -127,7 +136,7 @@ public void addRepository( final Repository repository, boolean replace )
{
if ( !repositoryIds.add( repository.getId() ) )
{
if ( !replace )
if ( !replace || this.externalRepositoryIds.contains( repository.getId() ) )
{
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ class DefaultModelResolver

private final List<RemoteRepository> externalRepositories;

private final Set<String> externalRepositoryIds;

private final ArtifactResolver resolver;

private final VersionRangeResolver versionRangeResolver;
Expand All @@ -92,8 +94,13 @@ class DefaultModelResolver
List<RemoteRepository> externalRepositories = new ArrayList<>();
externalRepositories.addAll( repositories );
this.externalRepositories = Collections.unmodifiableList( externalRepositories );

this.repositoryIds = new HashSet<>();
this.externalRepositoryIds = new HashSet<>();
for ( final RemoteRepository repository : this.repositories )
{
this.repositoryIds.add( repository.getId() );
this.externalRepositoryIds.add( repository.getId() );
}
}

private DefaultModelResolver( DefaultModelResolver original )
Expand All @@ -107,6 +114,7 @@ private DefaultModelResolver( DefaultModelResolver original )
this.repositories = new ArrayList<>( original.repositories );
this.externalRepositories = original.externalRepositories;
this.repositoryIds = new HashSet<>( original.repositoryIds );
this.externalRepositoryIds = new HashSet<>( original.externalRepositoryIds );
}

@Override
Expand All @@ -127,7 +135,7 @@ public void addRepository( final Repository repository, boolean replace )

if ( !repositoryIds.add( repository.getId() ) )
{
if ( !replace )
if ( !replace || this.externalRepositoryIds.contains( repository.getId() ) )
{
return;
}
Expand Down