Class AbstractSiteRenderingMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
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.
Version:
$Id: AbstractSiteRenderingMojo.java 1767163 2016-10-30 14:50:13Z hboutemy $
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private Map<String,Object>
    Additional template properties for rendering the site.
    private org.codehaus.plexus.PlexusContainer
     
    protected File
    Directory containing generated documentation.
    private boolean
    Whether to generate the summary page for project reports: project-info.html.
    private String
    Specifies the input encoding.
    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)
    private String
    Specifies the output encoding.
    private org.apache.maven.reporting.exec.ReportPlugin[]
    Configuration section used internally by Maven 3.
    protected List<org.apache.maven.reporting.MavenReport>
    Reports (Maven 2).
    private boolean
    Whether to save Velocity processed Doxia content (*.<ext>.vm) to ${generatedSiteDirectory}/processed.
    protected org.apache.maven.doxia.siterenderer.Renderer
    Site renderer.
    private File
    The location of a Velocity template file to use.
    private File
    Deprecated.
    use the standard m2 directory layout

    Fields inherited from class org.apache.maven.plugins.site.descriptor.AbstractSiteDescriptorMojo

    repositories, siteDirectory

    Fields inherited from class org.apache.maven.plugins.site.AbstractSiteMojo

    i18n, localRepository, project, reactorProjects, 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
     
    void
    contextualize(org.codehaus.plexus.context.Context context)
    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>
     
    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.decoration.MenuItem> items, Locale locale, Map<String,org.apache.maven.reporting.MavenReport> reportsByOutputName)
     
    protected void
    populateReportItems(org.apache.maven.doxia.site.decoration.DecorationModel decorationModel, Locale locale, Map<String,org.apache.maven.reporting.MavenReport> reportsByOutputName)
     

    Methods inherited from class org.apache.maven.plugins.site.descriptor.AbstractSiteDescriptorMojo

    prepareDecorationModel

    Methods inherited from class org.apache.maven.plugins.site.AbstractSiteMojo

    getLocales, getMavenVersion, isMaven3OrMore

    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>
       
    • templateFile

      @Parameter(property="templateFile") private 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 Map<String,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 List<org.apache.maven.reporting.MavenReport> reports
      Reports (Maven 2).
    • xdocDirectory

      @Parameter(defaultValue="${basedir}/xdocs") private 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 File generatedSiteDirectory
      Directory containing generated documentation. This is used to pick up other source docs that might have been generated at build time.
    • mavenSession

      @Parameter(defaultValue="${session}", readonly=true, required=true) protected org.apache.maven.execution.MavenSession mavenSession
      The current Maven session.
    • reportPlugins

      @Parameter(readonly=true) private org.apache.maven.reporting.exec.ReportPlugin[] reportPlugins

      Configuration section used internally by Maven 3.

      More details available here: http://maven.apache.org/plugins/maven-site-plugin/maven-3.html#Configuration_formats

      Note: using this field is not mandatory with Maven 3 as Maven core injects usual <reporting> section into this field.

      Since:
      3.0-beta-1 (and read-only since 3.3)
    • 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 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
    • 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.
    • 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 List<org.apache.maven.reporting.exec.MavenReportExecution> getReports() 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.
      Throws:
      IOException
      org.apache.maven.doxia.siterenderer.RendererException
      See Also:
    • populateReportItems

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

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