in src/main/java/org/apache/maven/reporting/AbstractMavenReport.java [273:315]
private SiteRenderingContext createSiteRenderingContext(Locale locale)
throws MavenReportException, IOException, SiteToolException {
SiteModel siteModel = siteTool.getSiteModel(
siteDirectory, locale, project, reactorProjects, repoSession, remoteProjectRepositories);
Map<String, Object> templateProperties = new HashMap<>();
// We tell the skin that we are rendering in standalone mode
templateProperties.put("standalone", Boolean.TRUE);
templateProperties.put("project", getProject());
templateProperties.put("inputEncoding", getInputEncoding());
templateProperties.put("outputEncoding", getOutputEncoding());
// Put any of the properties in directly into the Velocity context
for (Map.Entry<Object, Object> entry : getProject().getProperties().entrySet()) {
templateProperties.put((String) entry.getKey(), entry.getValue());
}
SiteRenderingContext context;
try {
Artifact skinArtifact =
siteTool.getSkinArtifactFromRepository(repoSession, remoteProjectRepositories, siteModel.getSkin());
getLog().info(buffer().a("Rendering content with ")
.strong(skinArtifact.getId() + " skin")
.toString());
context = siteRenderer.createContextForSkin(
skinArtifact, templateProperties, siteModel, project.getName(), locale);
} catch (SiteToolException e) {
throw new MavenReportException("Failed to retrieve skin artifact", e);
} catch (RendererException e) {
throw new MavenReportException("Failed to create context for skin", e);
}
// Add publish date
MavenArchiver.parseBuildOutputTimestamp(outputTimestamp).ifPresent(v -> {
context.setPublishDate(Date.from(v));
});
// Generate static site
context.setRootDirectory(project.getBasedir());
return context;
}