Class AbstractSiteRenderingMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
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 Map<String,Object>
    Additional template properties for rendering the site.
    protected File
    Directory containing generated documentation in source format (Doxia supported markup).
    private boolean
    Whether to generate the summary page for project reports: project-info.html.
    private boolean
    Generate a sitemap.
    private String
    Specifies the input encoding.
    protected org.apache.maven.reporting.exec.MavenReportExecutor
     
    protected org.apache.maven.execution.MavenSession
    The current Maven session.
    private Map<String,String>
    Module type exclusion mappings ex: fml -> **/*-m1.fml (excludes fml files ending in '-m1.fml' recursively)
    protected org.apache.maven.plugin.MojoExecution
    The mojo execution
    private String
    Specifies the output encoding.
    protected String
    Timestamp for reproducible output archive entries, either formatted as ISO 8601 yyyy-MM-dd'T'HH:mm:ssXXX or as an int representing seconds since the epoch (like SOURCE_DATE_EPOCH).
    private org.apache.maven.model.Reporting
    replaces previous reportPlugins parameter, that was injected by Maven core from reporting section: but this new configuration format has been abandoned.
    private boolean
    Whether to save Velocity processed Doxia content (*.<ext>.vm) to ${generatedSiteDirectory}/processed.
    protected org.apache.maven.doxia.siterenderer.SiteRenderer
    Site 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

    Fields inherited from interface org.apache.maven.plugin.Mojo

    ROLE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected Map<String,List<org.apache.maven.reporting.MavenReport>>
    categoriseReports(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 void
     
    protected org.apache.maven.doxia.siterenderer.SiteRenderingContext
     
    protected String
    Gets the input files encoding.
    protected String
    Gets the effective reporting output files encoding.
    private org.apache.maven.model.ReportPlugin[]
    Get the report plugins from reporting section, adding if necessary (i.e.
    protected List<org.apache.maven.reporting.exec.MavenReportExecution>
    getReports(File outputDirectory)
     
    protected Map<String,org.apache.maven.doxia.siterenderer.DocumentRenderer>
    locateDocuments(org.apache.maven.doxia.siterenderer.SiteRenderingContext context, List<org.apache.maven.reporting.exec.MavenReportExecution> reports, 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 Map<String,org.apache.maven.reporting.MavenReport>
    locateReports(List<org.apache.maven.reporting.exec.MavenReportExecution> reports, Map<String,org.apache.maven.doxia.siterenderer.DocumentRenderer> documents, 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
    private void
    populateItemRefs(List<org.apache.maven.doxia.site.MenuItem> items, Locale locale, Map<String,org.apache.maven.reporting.MavenReport> reportsByOutputName)
     
    protected void
    populateReportItems(org.apache.maven.doxia.site.SiteModel siteModel, Locale locale, Map<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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.maven.plugin.Mojo

    execute
  • Field Details

    • moduleExcludes

      @Parameter private Map<String,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 Map<String,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 File generatedSiteDirectory
      Directory 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 as siteDirectory (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 mavenSession
      The current Maven session.
    • mojoExecution

      @Parameter(defaultValue="${mojoExecution}", readonly=true, required=true) protected org.apache.maven.plugin.MojoExecution mojoExecution
      The mojo execution
    • reporting

      @Parameter(defaultValue="${project.reporting}", readonly=true) private org.apache.maven.model.Reporting reporting
      replaces 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 generateProjectInfo
      Whether to generate the summary page for project reports: project-info.html.
      Since:
      2.3
    • generateSitemap

      @Parameter(property="generateSitemap", defaultValue="false") private boolean generateSitemap
      Generate 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 String inputEncoding
      Specifies the input encoding.
      Since:
      2.3
    • outputEncoding

      @Parameter(property="outputEncoding", defaultValue="${project.reporting.outputEncoding}") private String outputEncoding
      Specifies the output encoding.
      Since:
      2.3
    • outputTimestamp

      @Parameter(defaultValue="${project.build.outputTimestamp}") protected String outputTimestamp
      Timestamp for reproducible output archive entries, either formatted as ISO 8601 yyyy-MM-dd'T'HH:mm:ssXXX or 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
  • Constructor Details

    • AbstractSiteRenderingMojo

      public AbstractSiteRenderingMojo()
  • Method Details

    • getInputEncoding

      protected String getInputEncoding()
      Gets the input files encoding.
      Returns:
      The input files encoding, never null.
    • getOutputEncoding

      protected String getOutputEncoding()
      Gets the effective reporting output files encoding.
      Returns:
      The effective reporting output file encoding, never null.
    • checkInputEncoding

      protected void checkInputEncoding()
    • getReports

      protected List<org.apache.maven.reporting.exec.MavenReportExecution> getReports(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(Locale locale) throws org.apache.maven.plugin.MojoExecutionException, IOException, org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
      IOException
      org.apache.maven.plugin.MojoFailureException
    • locateReports

      protected Map<String,org.apache.maven.reporting.MavenReport> locateReports(List<org.apache.maven.reporting.exec.MavenReportExecution> reports, Map<String,org.apache.maven.doxia.siterenderer.DocumentRenderer> documents, 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 MavenReports
      documents - A Map of documents, keyed by filename
      locale - 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 Map<String,List<org.apache.maven.reporting.MavenReport>> categoriseReports(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 Map<String,org.apache.maven.doxia.siterenderer.DocumentRenderer> locateDocuments(org.apache.maven.doxia.siterenderer.SiteRenderingContext context, List<org.apache.maven.reporting.exec.MavenReportExecution> reports, Locale locale) throws IOException, org.apache.maven.doxia.siterenderer.RendererException
      Locate 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 context
      reports - the documents
      locale - the locale
      Returns:
      the documents and their renderers
      Throws:
      IOException - in case of file reading issue
      org.apache.maven.doxia.siterenderer.RendererException - in case of Doxia rendering issue
      See Also:
    • populateReportItems

      protected void populateReportItems(org.apache.maven.doxia.site.SiteModel siteModel, Locale locale, Map<String,org.apache.maven.reporting.MavenReport> reportsByOutputName)
    • populateItemRefs

      private void populateItemRefs(List<org.apache.maven.doxia.site.MenuItem> items, Locale locale, Map<String,org.apache.maven.reporting.MavenReport> reportsByOutputName)