in maven-jxr/src/main/java/org/apache/maven/jxr/DirectoryIndexer.java [255:280]
private void doVelocity(String templateName, String outDir, VelocityContext context, VelocityEngine engine)
throws JxrException {
// output file
File file = new File(outDir, templateName + ".html");
file.getParentFile().mkdirs();
try (Writer writer = new OutputStreamWriter(new FileOutputStream(file), getOutputEncoding())) {
// template file
StringBuilder templateFile = new StringBuilder();
File templateDirFile = new File(getTemplateDir());
if (!templateDirFile.isAbsolute()) {
// default templates
templateFile.append(getTemplateDir());
templateFile.append('/');
}
templateFile.append(templateName);
templateFile.append(".vm");
Template template = engine.getTemplate(templateFile.toString());
// do the merge
template.merge(context, writer);
writer.flush();
} catch (Exception e) {
throw new JxrException("Error merging velocity template", e);
}
}