Skip to content

Commit

Permalink
Cache mirrors in MavenPomDownloader (#4159)
Browse files Browse the repository at this point in the history
  • Loading branch information
knutwannheden authored Apr 30, 2024
1 parent a94ecdd commit 88d9bc9
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public class MavenPomDownloader {

@Nullable
private MavenSettings mavenSettings;
private Collection<MavenRepositoryMirror> mirrors;

@Nullable
private List<String> activeProfiles;
Expand All @@ -97,6 +98,7 @@ public MavenPomDownloader(Map<Path, Pom> projectPoms, ExecutionContext ctx,
@Nullable List<String> activeProfiles) {
this(projectPoms, HttpSenderExecutionContextView.view(ctx).getHttpSender(), ctx);
this.mavenSettings = mavenSettings;
this.mirrors = this.ctx.getMirrors(mavenSettings);
this.activeProfiles = activeProfiles;
}

Expand Down Expand Up @@ -137,6 +139,7 @@ public MavenPomDownloader(Map<Path, Pom> projectPoms, HttpSender httpSender, Exe
this.mavenCache = this.ctx.getPomCache();
this.addCentralRepository = !Boolean.FALSE.equals(MavenExecutionContextView.view(ctx).getAddCentralRepository());
this.addLocalRepository = !Boolean.FALSE.equals(MavenExecutionContextView.view(ctx).getAddLocalRepository());
this.mirrors = this.ctx.getMirrors(this.ctx.getSettings());
}

byte[] sendRequest(HttpSender.Request request) throws IOException, HttpSenderResponseException {
Expand Down Expand Up @@ -861,7 +864,7 @@ private static boolean hasCredentials(MavenRepository repository) {
}

private MavenRepository applyMirrors(MavenRepository repository) {
return MavenRepositoryMirror.apply(ctx.getMirrors(mavenSettings), repository);
return MavenRepositoryMirror.apply(mirrors, repository);
}

@Getter
Expand Down

0 comments on commit 88d9bc9

Please sign in to comment.