From 62c94d123ceb270afb4f34932d8be5f2282095ae Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Tue, 5 Nov 2024 17:01:08 +0100 Subject: [PATCH] [MNG-8368] Fix dependency resolver not using project repositories (#1865) --- .../maven/internal/impl/DefaultDependencyResolver.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/impl/maven-impl/src/main/java/org/apache/maven/internal/impl/DefaultDependencyResolver.java b/impl/maven-impl/src/main/java/org/apache/maven/internal/impl/DefaultDependencyResolver.java index d91d43dab2..adfed73704 100644 --- a/impl/maven-impl/src/main/java/org/apache/maven/internal/impl/DefaultDependencyResolver.java +++ b/impl/maven-impl/src/main/java/org/apache/maven/internal/impl/DefaultDependencyResolver.java @@ -167,8 +167,13 @@ public class DefaultDependencyResolver implements DependencyResolver { InternalSession.from(nonNull(request, "request").getSession()); DependencyResolverResult result; DependencyResolverResult collectorResult = collect(request); - List repositories = - request.getRepositories() != null ? request.getRepositories() : session.getRemoteRepositories(); + List repositories = request.getRepositories() != null + ? request.getRepositories() + : request.getProject().isPresent() + ? session.getService(ProjectManager.class) + .getRemoteProjectRepositories( + request.getProject().get()) + : session.getRemoteRepositories(); if (request.getRequestType() == DependencyResolverRequest.RequestType.COLLECT) { result = collectorResult; } else {