Class AbstractSiteRenderingMojo

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo, org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
    Direct Known Subclasses:
    SiteMojo, SiteRunMojo

    public abstract class AbstractSiteRenderingMojo
    extends AbstractSiteDescriptorMojo
    implements org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
    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.
      private org.codehaus.plexus.PlexusContainer container  
      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 java.lang.String inputEncoding
      Specifies the input encoding.
      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)
      private java.lang.String outputEncoding
      Specifies the output encoding.
      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.
      protected java.util.List<org.apache.maven.reporting.MavenReport> reports
      Reports (Maven 2).
      private boolean saveProcessedContent
      Whether to save Velocity processed Doxia content (*.<ext>.vm) to ${generatedSiteDirectory}/processed.
      protected org.apache.maven.doxia.siterenderer.Renderer siteRenderer
      Site renderer.
      private java.io.File templateFile
      The location of a Velocity template file to use.
      private java.io.File xdocDirectory
      Deprecated.
      use the standard m2 directory layout
      • 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()  
      void contextualize​(org.codehaus.plexus.context.Context context)
      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 (ni.e.
      protected java.util.List<org.apache.maven.reporting.exec.MavenReportExecution> getReports()  
      private java.lang.String getSitePluginInfo()  
      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.decoration.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.decoration.DecorationModel decorationModel, 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>
         
      • templateFile

        @Parameter(property="templateFile")
        private java.io.File templateFile
        The location of a Velocity template file to use. When used, skins and the default templates, CSS and images are disabled. It is highly recommended that you package this as a skin instead.
        Since:
        2.0-beta-5
      • 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.Renderer siteRenderer
        Site renderer.
      • reports

        @Parameter(defaultValue="${reports}",
                   required=true,
                   readonly=true)
        protected java.util.List<org.apache.maven.reporting.MavenReport> reports
        Reports (Maven 2).
      • xdocDirectory

        @Parameter(defaultValue="${basedir}/xdocs")
        private java.io.File xdocDirectory
        Deprecated.
        use the standard m2 directory layout
        Alternative directory for xdoc source, useful for m1 to m2 migration
      • 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).
      • mavenSession

        @Parameter(defaultValue="${session}",
                   readonly=true,
                   required=true)
        protected org.apache.maven.execution.MavenSession mavenSession
        The current Maven session.
      • 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
      • container

        private org.codehaus.plexus.PlexusContainer container
      • generateProjectInfo

        @Parameter(property="generateProjectInfo",
                   defaultValue="true")
        private boolean generateProjectInfo
        Whether to generate the summary page for project reports: project-info.html.
        Since:
        2.3
      • 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
      • 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.
      • contextualize

        public void contextualize​(org.codehaus.plexus.context.Context context)
                           throws org.codehaus.plexus.context.ContextException
        Specified by:
        contextualize in interface org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
        Throws:
        org.codehaus.plexus.context.ContextException
      • checkInputEncoding

        protected void checkInputEncoding()
      • getReports

        protected java.util.List<org.apache.maven.reporting.exec.MavenReportExecution> getReports()
                                                                                           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 (ni.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.
        Throws:
        java.io.IOException
        org.apache.maven.doxia.siterenderer.RendererException
        See Also:
        CategorySummaryDocumentRenderer
      • getSitePluginInfo

        private java.lang.String getSitePluginInfo()
      • populateReportItems

        protected void populateReportItems​(org.apache.maven.doxia.site.decoration.DecorationModel decorationModel,
                                           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.decoration.MenuItem> items,
                                      java.util.Locale locale,
                                      java.util.Map<java.lang.String,​org.apache.maven.reporting.MavenReport> reportsByOutputName)