Class AbstractSiteRenderingMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.apache.maven.plugins.site.AbstractSiteMojo
-
- org.apache.maven.plugins.site.descriptor.AbstractSiteDescriptorMojo
-
- org.apache.maven.plugins.site.render.AbstractSiteRenderingMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
SiteMojo,SiteRunMojo
public abstract class AbstractSiteRenderingMojo extends AbstractSiteDescriptorMojo
Base class for site rendering mojos.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,java.lang.Object>attributesAdditional template properties for rendering the site.protected java.io.FilegeneratedSiteDirectoryDirectory containing generated documentation in source format (Doxia supported markup).private booleangenerateProjectInfoWhether to generate the summary page for project reports: project-info.html.private booleangenerateSitemapGenerate a sitemap.private java.lang.StringinputEncodingSpecifies the input encoding.protected org.apache.maven.reporting.exec.MavenReportExecutormavenReportExecutorprotected org.apache.maven.execution.MavenSessionmavenSessionThe current Maven session.private java.util.Map<java.lang.String,java.lang.String>moduleExcludesModule type exclusion mappings ex:fml -> **/*-m1.fml(excludes fml files ending in '-m1.fml' recursively)protected org.apache.maven.plugin.MojoExecutionmojoExecutionThe mojo executionprivate java.lang.StringoutputEncodingSpecifies the output encoding.protected java.lang.StringoutputTimestampTimestamp for reproducible output archive entries, either formatted as ISO 8601yyyy-MM-dd'T'HH:mm:ssXXXor as an int representing seconds since the epoch (like SOURCE_DATE_EPOCH).private org.apache.maven.model.Reportingreportingreplaces previous reportPlugins parameter, that was injected by Maven core from reporting section: but this new configuration format has been abandoned.private booleansaveProcessedContentWhether to save Velocity processed Doxia content (*.<ext>.vm) to${generatedSiteDirectory}/processed.protected org.apache.maven.doxia.siterenderer.SiteRenderersiteRendererSite renderer.-
Fields inherited from class org.apache.maven.plugins.site.descriptor.AbstractSiteDescriptorMojo
reactorProjects, remoteProjectRepositories, repoSession, siteDirectory
-
Fields inherited from class org.apache.maven.plugins.site.AbstractSiteMojo
i18n, project, siteTool, skip
-
-
Constructor Summary
Constructors Constructor Description AbstractSiteRenderingMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Map<java.lang.String,java.util.List<org.apache.maven.reporting.MavenReport>>categoriseReports(java.util.Collection<org.apache.maven.reporting.MavenReport> reports)Go through the collection of reports and put each report into a list for the appropriate category.protected voidcheckInputEncoding()protected org.apache.maven.doxia.siterenderer.SiteRenderingContextcreateSiteRenderingContext(java.util.Locale locale)protected java.lang.StringgetInputEncoding()Gets the input files encoding.protected java.lang.StringgetOutputEncoding()Gets the effective reporting output files encoding.private org.apache.maven.model.ReportPlugin[]getReportingPlugins()Get the report plugins from reporting section, adding if necessary (i.e.protected java.util.List<org.apache.maven.reporting.exec.MavenReportExecution>getReports(java.io.File outputDirectory)protected java.util.Map<java.lang.String,org.apache.maven.doxia.siterenderer.DocumentRenderer>locateDocuments(org.apache.maven.doxia.siterenderer.SiteRenderingContext context, java.util.List<org.apache.maven.reporting.exec.MavenReportExecution> reports, java.util.Locale locale)Locate every document to be rendered for given locale: handwritten content, ie Doxia files, reports, "Project Information" and "Project Reports" category summaries.protected java.util.Map<java.lang.String,org.apache.maven.reporting.MavenReport>locateReports(java.util.List<org.apache.maven.reporting.exec.MavenReportExecution> reports, java.util.Map<java.lang.String,org.apache.maven.doxia.siterenderer.DocumentRenderer> documents, java.util.Locale locale)Go through the list of reports and process each one like this: Add the report to a map of reports keyed by filename having the report itself as value If the report is not yet in the map of documents, add it together with a suitable rendererprivate voidpopulateItemRefs(java.util.List<org.apache.maven.doxia.site.MenuItem> items, java.util.Locale locale, java.util.Map<java.lang.String,org.apache.maven.reporting.MavenReport> reportsByOutputName)protected voidpopulateReportItems(org.apache.maven.doxia.site.SiteModel siteModel, java.util.Locale locale, java.util.Map<java.lang.String,org.apache.maven.reporting.MavenReport> reportsByOutputName)-
Methods inherited from class org.apache.maven.plugins.site.descriptor.AbstractSiteDescriptorMojo
prepareSiteModel
-
Methods inherited from class org.apache.maven.plugins.site.AbstractSiteMojo
getLocales
-
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
-
-
-
Field Detail
-
moduleExcludes
@Parameter private java.util.Map<java.lang.String,java.lang.String> moduleExcludes
Module type exclusion mappings ex:fml -> **/*-m1.fml(excludes fml files ending in '-m1.fml' recursively) The configuration looks like this:<moduleExcludes> <moduleType>filename1.ext,**/*sample.ext</moduleType> <!-- moduleType can be one of 'apt', 'fml' or 'xdoc'. --> <!-- The value is a comma separated list of --> <!-- filenames or fileset patterns. --> <!-- Here's an example: --> <xdoc>changes.xml,navigation.xml</xdoc> </moduleExcludes>
-
attributes
@Parameter private java.util.Map<java.lang.String,java.lang.Object> attributes
Additional template properties for rendering the site. See Doxia Site Renderer.
-
siteRenderer
@Component protected org.apache.maven.doxia.siterenderer.SiteRenderer siteRenderer
Site renderer.
-
generatedSiteDirectory
@Parameter(alias="workingDirectory", defaultValue="${project.build.directory}/generated-site") protected java.io.File generatedSiteDirectoryDirectory containing generated documentation in source format (Doxia supported markup). This is used to pick up other source docs that might have been generated at build time (by reports or any other build time mean). This directory is expected to have the same structure assiteDirectory(ie. one directory per Doxia-source-supported markup types). todo should we deprecate in favour of reports directly using Doxia Sink API, without this Doxia source intermediate step?
-
mavenSession
@Parameter(defaultValue="${session}", readonly=true, required=true) protected org.apache.maven.execution.MavenSession mavenSessionThe current Maven session.
-
mojoExecution
@Parameter(defaultValue="${mojoExecution}", readonly=true, required=true) protected org.apache.maven.plugin.MojoExecution mojoExecutionThe mojo execution
-
reporting
@Parameter(defaultValue="${project.reporting}", readonly=true) private org.apache.maven.model.Reporting reportingreplaces previous reportPlugins parameter, that was injected by Maven core from reporting section: but this new configuration format has been abandoned.- Since:
- 3.7.1
-
generateProjectInfo
@Parameter(property="generateProjectInfo", defaultValue="true") private boolean generateProjectInfoWhether to generate the summary page for project reports: project-info.html.- Since:
- 2.3
-
generateSitemap
@Parameter(property="generateSitemap", defaultValue="false") private boolean generateSitemapGenerate a sitemap. The result will be a "sitemap.html" file at the site root.- Since:
- 2.1
-
inputEncoding
@Parameter(property="encoding", defaultValue="${project.build.sourceEncoding}") private java.lang.String inputEncodingSpecifies the input encoding.- Since:
- 2.3
-
outputEncoding
@Parameter(property="outputEncoding", defaultValue="${project.reporting.outputEncoding}") private java.lang.String outputEncodingSpecifies the output encoding.- Since:
- 2.3
-
outputTimestamp
@Parameter(defaultValue="${project.build.outputTimestamp}") protected java.lang.String outputTimestampTimestamp for reproducible output archive entries, either formatted as ISO 8601yyyy-MM-dd'T'HH:mm:ssXXXor as an int representing seconds since the epoch (like SOURCE_DATE_EPOCH).- Since:
- 3.9.0
-
mavenReportExecutor
@Component protected org.apache.maven.reporting.exec.MavenReportExecutor mavenReportExecutor
-
saveProcessedContent
@Parameter private boolean saveProcessedContent
Whether to save Velocity processed Doxia content (*.<ext>.vm) to${generatedSiteDirectory}/processed.- Since:
- 3.5
-
-
Method Detail
-
getInputEncoding
protected java.lang.String getInputEncoding()
Gets the input files encoding.- Returns:
- The input files encoding, never
null.
-
getOutputEncoding
protected java.lang.String getOutputEncoding()
Gets the effective reporting output files encoding.- Returns:
- The effective reporting output file encoding, never
null.
-
checkInputEncoding
protected void checkInputEncoding()
-
getReports
protected java.util.List<org.apache.maven.reporting.exec.MavenReportExecution> getReports(java.io.File outputDirectory) throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getReportingPlugins
private org.apache.maven.model.ReportPlugin[] getReportingPlugins()
Get the report plugins from reporting section, adding if necessary (i.e. not excluded) default reports (i.e. maven-project-info-reports)- Returns:
- the effective list of reports
- Since:
- 3.7.1
-
createSiteRenderingContext
protected org.apache.maven.doxia.siterenderer.SiteRenderingContext createSiteRenderingContext(java.util.Locale locale) throws org.apache.maven.plugin.MojoExecutionException, java.io.IOException, org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoExecutionExceptionjava.io.IOExceptionorg.apache.maven.plugin.MojoFailureException
-
locateReports
protected java.util.Map<java.lang.String,org.apache.maven.reporting.MavenReport> locateReports(java.util.List<org.apache.maven.reporting.exec.MavenReportExecution> reports, java.util.Map<java.lang.String,org.apache.maven.doxia.siterenderer.DocumentRenderer> documents, java.util.Locale locale)Go through the list of reports and process each one like this:- Add the report to a map of reports keyed by filename having the report itself as value
- If the report is not yet in the map of documents, add it together with a suitable renderer
- Parameters:
reports- A List of MavenReportsdocuments- A Map of documents, keyed by filenamelocale- the Locale the reports are processed for.- Returns:
- A map with all reports keyed by filename having the report itself as value. The map will be used to populate a menu.
-
categoriseReports
protected java.util.Map<java.lang.String,java.util.List<org.apache.maven.reporting.MavenReport>> categoriseReports(java.util.Collection<org.apache.maven.reporting.MavenReport> reports)
Go through the collection of reports and put each report into a list for the appropriate category. The list is put into a map keyed by the name of the category.- Parameters:
reports- A Collection of MavenReports- Returns:
- A map keyed category having the report itself as value
-
locateDocuments
protected java.util.Map<java.lang.String,org.apache.maven.doxia.siterenderer.DocumentRenderer> locateDocuments(org.apache.maven.doxia.siterenderer.SiteRenderingContext context, java.util.List<org.apache.maven.reporting.exec.MavenReportExecution> reports, java.util.Locale locale) throws java.io.IOException, org.apache.maven.doxia.siterenderer.RendererExceptionLocate every document to be rendered for given locale:- handwritten content, ie Doxia files,
- reports,
- "Project Information" and "Project Reports" category summaries.
- Parameters:
context- the site contextreports- the documentslocale- the locale- Returns:
- the documents and their renderers
- Throws:
java.io.IOException- in case of file reading issueorg.apache.maven.doxia.siterenderer.RendererException- in case of Doxia rendering issue- See Also:
CategorySummaryDocumentRenderer
-
populateReportItems
protected void populateReportItems(org.apache.maven.doxia.site.SiteModel siteModel, java.util.Locale locale, java.util.Map<java.lang.String,org.apache.maven.reporting.MavenReport> reportsByOutputName)
-
populateItemRefs
private void populateItemRefs(java.util.List<org.apache.maven.doxia.site.MenuItem> items, java.util.Locale locale, java.util.Map<java.lang.String,org.apache.maven.reporting.MavenReport> reportsByOutputName)
-
-