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:
AutoRefreshMojo, SiteMojo, SiteRunMojo

public abstract class AbstractSiteRenderingMojo extends AbstractSiteDescriptorMojo
Base class for site rendering mojos.
Author:
Brett Porter
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected File[]
    Optional list of source directories to be used instead of AbstractSiteDescriptorMojo.siteDirectory for rendering edit URLs.
    protected File
    Directory containing generated documentation in source format (Doxia supported markup).
    protected final org.apache.maven.reporting.exec.MavenReportExecutor
     
    protected org.apache.maven.execution.MavenSession
    The current Maven session.
    protected org.apache.maven.plugin.MojoExecution
    The mojo execution
    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).
    protected final 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
    Modifier
    Constructor
    Description
    protected
    AbstractSiteRenderingMojo(org.apache.maven.doxia.site.inheritance.SiteModelInheritanceAssembler assembler, org.apache.maven.doxia.siterenderer.SiteRenderer siteRenderer, org.apache.maven.reporting.exec.MavenReportExecutor mavenReportExecutor)
     
  • 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.
    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
    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

    • 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). This is never editable.
    • alternativeSiteSourceDirectories

      @Parameter protected File[] alternativeSiteSourceDirectories
      Optional list of source directories to be used instead of AbstractSiteDescriptorMojo.siteDirectory for rendering edit URLs. This is only used for documents rendered from AbstractSiteDescriptorMojo.siteDirectory but not for those rendered from generatedSiteDirectory. as the latter ones are always considered non-editable. The first directory containing a document with the given relative path is used for generating the URL (the same relative path as the document has to AbstractSiteDescriptorMojo.siteDirectory).
      Since:
      3.22.0
    • 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
    • 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
    • siteRenderer

      protected final org.apache.maven.doxia.siterenderer.SiteRenderer siteRenderer
      Site renderer.
    • mavenReportExecutor

      protected final org.apache.maven.reporting.exec.MavenReportExecutor mavenReportExecutor
  • Constructor Details

    • AbstractSiteRenderingMojo

      protected AbstractSiteRenderingMojo(org.apache.maven.doxia.site.inheritance.SiteModelInheritanceAssembler assembler, org.apache.maven.doxia.siterenderer.SiteRenderer siteRenderer, org.apache.maven.reporting.exec.MavenReportExecutor mavenReportExecutor)
  • 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
    • 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)