in freemarker-generator-cli/src/main/java/org/apache/freemarker/generator/cli/task/FreeMarkerTask.java [91:108]
private void process(Configuration configuration,
OutputGenerator outputGenerator,
Map<String, Object> sharedDataModelMap,
List<DataSource> sharedDataSources,
Map<String, Object> sharedParameters) {
final TemplateSource templateSource = outputGenerator.getTemplateSource();
final TemplateOutput templateOutput = outputGenerator.getTemplateOutput();
final DataSources dataSources = toDataSources(outputGenerator, sharedDataSources);
final Map<String, Object> variables = outputGenerator.getVariables();
final Map<String, Object> templateDataModel = toTemplateDataModel(dataSources, variables, sharedDataModelMap, sharedParameters);
try (Writer writer = writer(templateOutput)) {
final Template template = template(configuration, templateSource);
template.process(templateDataModel, writer);
} catch (TemplateException | IOException | RuntimeException e) {
throw new RuntimeException("Failed to process template: " + templateSource.getName(), e);
}
}