private void downloadFileFromRepository()

in src/main/java/org/apache/sling/cli/impl/nexus/RepositoryService.java [247:260]


    private void downloadFileFromRepository(@NotNull StagingRepository repository, @NotNull CloseableHttpClient client,
                                            @NotNull Path artifactFolderPath, @NotNull String relativeFilePath) throws IOException {
        String fileName = relativeFilePath.substring(relativeFilePath.lastIndexOf('/') + 1);
        Path filePath = Files.createFile(artifactFolderPath.resolve(fileName));
        HttpGet get = new HttpGet(repository.getRepositoryURI() + "/" + relativeFilePath);
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Downloading {}.", get.getURI());
        }
        try (CloseableHttpResponse response = client.execute(get)) {
            try (InputStream content = response.getEntity().getContent()) {
                IOUtils.copyLarge(content, Files.newOutputStream(filePath));
            }
        }
    }