in src/main/java/org/apache/maven/buildcache/CacheControllerImpl.java [385:406]
private Future<File> createDownloadTask(
CacheResult cacheResult,
CacheContext context,
MavenProject project,
Artifact artifact,
String originalVersion) {
final FutureTask<File> downloadTask = new FutureTask<>(() -> {
LOGGER.debug("Downloading artifact {}", artifact.getArtifactId());
final Path artifactFile = localCache.getArtifactFile(context, cacheResult.getSource(), artifact);
if (!Files.exists(artifactFile)) {
throw new FileNotFoundException("Missing file for cached build, cannot restore. File: " + artifactFile);
}
LOGGER.debug("Downloaded artifact " + artifact.getArtifactId() + " to: " + artifactFile);
return restoreArtifactHandler
.adjustArchiveArtifactVersion(project, originalVersion, artifactFile)
.toFile();
});
if (!cacheConfig.isLazyRestore()) {
downloadTask.run();
}
return downloadTask;
}