class OpearPackageMojo extends AbstractCommonMojo {

    static Result<Map<URL, String>> copyUrlStreams(final @NotNull File toDir,
                                                   final @NotNull List<URL> urls) {
        final List<URL> dedupedUrls = new ArrayList<>(new LinkedHashSet<>(urls));
        final Map<String, URL> renamed =
                mapDestFileNames(new LinkedHashMap<>(), dedupedUrls, url -> Text.getName(url.getPath()));

        final Result<List<String>> filenameResults = renamed.entrySet().stream().map(result1(entry -> {
            try (InputStream is = entry.getValue().openStream()) {
                FileIOUtils.copyInputStreamToFile(is, new File(toDir, entry.getKey()));
                return entry.getKey();
            }
        })).collect(Result.tryCollect(Collectors.toList()));

        return filenameResults.map(filenames ->
                filenames.stream()
                        .map(zipValuesWithKeyFunc(renamed::get))
                        .collect(entriesToMap((v1, v2) -> v1)));
    }

}