Class 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> attributes
      Additional template properties for rendering the site.
      protected java.io.File generatedSiteDirectory
      Directory containing generated documentation in source format (Doxia supported markup).
      private boolean generateProjectInfo
      Whether to generate the summary page for project reports: project-info.html.
      private boolean generateSitemap
      Generate a sitemap.
      private java.lang.String inputEncoding
      Specifies the input encoding.
      protected org.apache.maven.reporting.exec.MavenReportExecutor mavenReportExecutor  
      protected org.apache.maven.execution.MavenSession mavenSession
      The current Maven session.
      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)
      protected org.apache.maven.plugin.MojoExecution mojoExecution
      The mojo execution
      private java.lang.String outputEncoding
      Specifies the output encoding.
      protected java.lang.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).
      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.
      private boolean saveProcessedContent
      Whether to save Velocity processed Doxia content (*.<ext>.vm) to ${generatedSiteDirectory}/processed.
      protected org.apache.maven.doxia.siterenderer.SiteRenderer siteRenderer
      Site renderer.
      • Fields inherited from interface org.apache.maven.plugin.Mojo

        ROLE
    • 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 void checkInputEncoding()  
      protected org.apache.maven.doxia.siterenderer.SiteRenderingContext createSiteRenderingContext​(java.util.Locale locale)  
      protected java.lang.String getInputEncoding()
      Gets the input files encoding.
      protected java.lang.String getOutputEncoding()
      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 renderer
      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)  
      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)  
      • 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 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 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 java.lang.String inputEncoding
        Specifies the input encoding.
        Since:
        2.3
      • outputEncoding

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

        @Parameter(defaultValue="${project.build.outputTimestamp}")
        protected java.lang.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 Detail

      • AbstractSiteRenderingMojo

        public AbstractSiteRenderingMojo()
    • 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.MojoExecutionException
        java.io.IOException
        org.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 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 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.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:
        java.io.IOException - in case of file reading issue
        org.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)