class OpearPackageMojo extends AbstractCommonMojo {

    static OakpalPlan rewritePlan(final @NotNull File toDir,
                                  final @NotNull Map<URL, String> renamed,
                                  final @NotNull OakpalPlan plan,
                                  final @NotNull String filename) {
        return new OakpalPlan.Builder(
                compose1(File::toURI, uncheck1(URI::toURL))
                        .apply(new File(toDir, filename)), filename)
                .startingWithPlan(plan)
                .withPreInstallUrls(plan.getPreInstallUrls().stream()
                        .map(compose1(renamed::get, uncheck1(name -> new File(toDir, name).toURI().toURL())))
                        .collect(Collectors.toList()))
                .withRepoInitUrls(plan.getRepoInitUrls().stream()
                        .map(compose1(renamed::get, uncheck1(name -> new File(toDir, name).toURI().toURL())))
                        .collect(Collectors.toList()))
                .build();
    }

}