private static void exportRelease()

in log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/exporter/ChangelogExporter.java [178:205]


    private static void exportRelease(
            final Path outputDirectory,
            final Path changelogDirectory,
            final Path releaseDirectory,
            final ChangelogRelease release,
            final Map<ChangelogEntry.Type, List<ChangelogEntry>> entriesByType,
            final Set<ChangelogExporterTemplate> changelogTemplates) {
        final Map<String, Object> changelogTemplateData = new LinkedHashMap<>();
        changelogTemplateData.put("release", release);
        changelogTemplateData.put("entriesByType", entriesByType);
        for (final ChangelogExporterTemplate changelogTemplate : changelogTemplates) {
            final Path changelogTemplateSourceFile = releaseDirectory.resolve(changelogTemplate.sourceFileName);
            if (Files.exists(changelogTemplateSourceFile)) {
                final String changelogTemplateName = templateName(changelogDirectory, changelogTemplateSourceFile);
                final String changelogTemplateTargetFileName =
                        changelogTemplate.targetFileName.replaceAll("%v", release.version);
                final Path changelogTemplateTargetFile = outputDirectory.resolve(changelogTemplateTargetFileName);
                FreeMarkerUtils.render(
                        changelogDirectory,
                        changelogTemplateName,
                        changelogTemplateData,
                        changelogTemplateTargetFile);
            } else if (changelogTemplate.failIfNotFound) {
                final String message = String.format("could not find template file: `%s`", changelogTemplateSourceFile);
                throw new IllegalStateException(message);
            }
        }
    }