Class PluginReport

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo, org.apache.maven.reporting.MavenMultiPageReport, org.apache.maven.reporting.MavenReport

    @Mojo(name="report",
          threadSafe=true)
    @Execute(phase=PROCESS_CLASSES)
    public class PluginReport
    extends org.apache.maven.reporting.AbstractMavenReport
    Generates the Plugin's documentation report: plugin-info.html plugin overview page, and one goal-mojo.html per goal.
    Since:
    2.0
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) static class  PluginReport.PluginOverviewRenderer
      Generates an overview page with the list of goals and a link to the goal's page.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Set<org.apache.maven.artifact.Artifact> dependencies
      The set of dependencies for the current project
      private java.lang.String encoding
      The file encoding of the source files.
      protected java.lang.String goalPrefix
      The goal prefix that will appear before the ":".
      protected org.apache.maven.artifact.repository.ArtifactRepository local
      Location of the local repository.
      protected MojoScanner mojoScanner
      Mojo scanner tools.
      private java.io.File outputDirectory
      Report output directory for mojos' documentation.
      private java.io.File pluginXmlFile
      Path to plugin.xml plugin descriptor to generate the report from.
      private org.apache.maven.project.MavenProject project
      The Maven Project.
      protected java.util.List<org.apache.maven.artifact.repository.ArtifactRepository> remoteRepos
      List of Remote Repositories used by the resolver
      private Requirements requirements
      Specify some requirements to execute this plugin.
      private org.apache.maven.execution.RuntimeInformation rtInfo  
      private org.apache.maven.doxia.siterenderer.Renderer siteRenderer
      Doxia Site Renderer.
      private boolean skip
      Set this to "true" to skip invoking any goals or reports of the plugin.
      private boolean skipReport
      Set this to "true" to skip generating the report.
      • Fields inherited from interface org.apache.maven.reporting.MavenReport

        CATEGORY_PROJECT_INFORMATION, CATEGORY_PROJECT_REPORTS, ROLE
      • Fields inherited from interface org.apache.maven.plugin.Mojo

        ROLE
    • Constructor Summary

      Constructors 
      Constructor Description
      PluginReport()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean canGenerateReport()
      protected void executeReport​(java.util.Locale locale)
      private org.apache.maven.plugin.descriptor.PluginDescriptor extractPluginDescriptor()  
      private void generateMojosDocumentation​(org.apache.maven.plugin.descriptor.PluginDescriptor pluginDescriptor, java.util.Locale locale)
      Generate the mojos documentation, as xdoc files.
      protected static java.util.ResourceBundle getBundle​(java.util.Locale locale)  
      java.lang.String getDescription​(java.util.Locale locale)
      java.lang.String getName​(java.util.Locale locale)
      protected java.lang.String getOutputDirectory()
      java.lang.String getOutputName()
      private org.apache.maven.plugin.descriptor.PluginDescriptorBuilder getPluginDescriptorBuilder()
      Return the pluginDescriptorBuilder to use based on the Maven version: either use the original from the maven-plugin-api or a patched version for Maven versions before the MNG-6109 fix (because of Maven MNG-6109 bug that won't give accurate 'since' info when reading plugin.xml).
      protected org.apache.maven.project.MavenProject getProject()
      protected org.apache.maven.doxia.siterenderer.Renderer getSiteRenderer()
      • Methods inherited from class org.apache.maven.reporting.AbstractMavenReport

        closeReport, execute, generate, generate, generate, getCategoryName, getInputEncoding, getOutputEncoding, getReportOutputDirectory, getSink, getSinkFactory, isExternalReport, setReportOutputDirectory
      • 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
    • Field Detail

      • outputDirectory

        @Parameter(defaultValue="${project.build.directory}/generated-site/xdoc")
        private java.io.File outputDirectory
        Report output directory for mojos' documentation.
      • siteRenderer

        @Component
        private org.apache.maven.doxia.siterenderer.Renderer siteRenderer
        Doxia Site Renderer.
      • encoding

        @Parameter(property="encoding",
                   defaultValue="${project.build.sourceEncoding}")
        private java.lang.String encoding
        The file encoding of the source files.
        Since:
        2.7
      • requirements

        @Parameter
        private Requirements requirements
        Specify some requirements to execute this plugin. Example:
         <requirements>
           <maven>2.0</maven>
           <jdk>1.4</jdk>
           <memory>256m</memory>
           <diskSpace>1m</diskSpace>
           <others>
             <property>
               <name>SVN</name>
               <value>1.4.6</value>
             </property>
           </others>
         </requirements>
         
        If not is specified, Maven requirement is extracted from <project><prerequisites><maven> and JDK requirement is extracted from maven-compiler-plugin configuration.
      • goalPrefix

        @Parameter(property="goalPrefix")
        protected java.lang.String goalPrefix

        The goal prefix that will appear before the ":". By default, this plugin applies a heuristic to derive a heuristic from the plugin's artifactId.

        It removes any occurrences of the regular expression -?maven-?, and then removes any occurrences of -?plugin-?.

        For example, horsefeature-maven-plugin becomes horsefeature.

        (There is a special case for maven-plugin-plugin: it is mapped to 'plugin')

        Since:
        2.4
      • skip

        @Parameter(defaultValue="false",
                   property="maven.plugin.skip")
        private boolean skip
        Set this to "true" to skip invoking any goals or reports of the plugin.
        Since:
        2.8
      • skipReport

        @Parameter(defaultValue="false",
                   property="maven.plugin.report.skip")
        private boolean skipReport
        Set this to "true" to skip generating the report.
        Since:
        2.8
      • dependencies

        @Parameter(defaultValue="${project.artifacts}",
                   required=true,
                   readonly=true)
        protected java.util.Set<org.apache.maven.artifact.Artifact> dependencies
        The set of dependencies for the current project
        Since:
        3.0
      • remoteRepos

        @Parameter(defaultValue="${project.remoteArtifactRepositories}",
                   required=true,
                   readonly=true)
        protected java.util.List<org.apache.maven.artifact.repository.ArtifactRepository> remoteRepos
        List of Remote Repositories used by the resolver
        Since:
        3.0
      • local

        @Parameter(defaultValue="${localRepository}",
                   required=true,
                   readonly=true)
        protected org.apache.maven.artifact.repository.ArtifactRepository local
        Location of the local repository.
        Since:
        3.0
      • rtInfo

        @Component
        private org.apache.maven.execution.RuntimeInformation rtInfo
        Since:
        3.5.1
      • pluginXmlFile

        @Parameter(defaultValue="${project.build.outputDirectory}/META-INF/maven/plugin.xml",
                   required=true,
                   readonly=true)
        private java.io.File pluginXmlFile
        Path to plugin.xml plugin descriptor to generate the report from.
        Since:
        3.5.1
    • Constructor Detail

      • PluginReport

        public PluginReport()
    • Method Detail

      • getSiteRenderer

        protected org.apache.maven.doxia.siterenderer.Renderer getSiteRenderer()
        Overrides:
        getSiteRenderer in class org.apache.maven.reporting.AbstractMavenReport
      • getOutputDirectory

        protected java.lang.String getOutputDirectory()
        Overrides:
        getOutputDirectory in class org.apache.maven.reporting.AbstractMavenReport
      • getProject

        protected org.apache.maven.project.MavenProject getProject()
        Overrides:
        getProject in class org.apache.maven.reporting.AbstractMavenReport
      • canGenerateReport

        public boolean canGenerateReport()
        Specified by:
        canGenerateReport in interface org.apache.maven.reporting.MavenReport
        Overrides:
        canGenerateReport in class org.apache.maven.reporting.AbstractMavenReport
      • executeReport

        protected void executeReport​(java.util.Locale locale)
                              throws org.apache.maven.reporting.MavenReportException
        Specified by:
        executeReport in class org.apache.maven.reporting.AbstractMavenReport
        Throws:
        org.apache.maven.reporting.MavenReportException
      • extractPluginDescriptor

        private org.apache.maven.plugin.descriptor.PluginDescriptor extractPluginDescriptor()
                                                                                     throws org.apache.maven.reporting.MavenReportException
        Throws:
        org.apache.maven.reporting.MavenReportException
      • getPluginDescriptorBuilder

        private org.apache.maven.plugin.descriptor.PluginDescriptorBuilder getPluginDescriptorBuilder()
        Return the pluginDescriptorBuilder to use based on the Maven version: either use the original from the maven-plugin-api or a patched version for Maven versions before the MNG-6109 fix (because of Maven MNG-6109 bug that won't give accurate 'since' info when reading plugin.xml).
        Returns:
        the proper pluginDescriptorBuilder
      • getDescription

        public java.lang.String getDescription​(java.util.Locale locale)
      • getName

        public java.lang.String getName​(java.util.Locale locale)
      • getOutputName

        public java.lang.String getOutputName()
      • generateMojosDocumentation

        private void generateMojosDocumentation​(org.apache.maven.plugin.descriptor.PluginDescriptor pluginDescriptor,
                                                java.util.Locale locale)
                                         throws org.apache.maven.reporting.MavenReportException
        Generate the mojos documentation, as xdoc files.
        Parameters:
        pluginDescriptor - not null
        locale - not null
        Throws:
        org.apache.maven.reporting.MavenReportException - if any
      • getBundle

        protected static java.util.ResourceBundle getBundle​(java.util.Locale locale)
        Parameters:
        locale - not null
        Returns:
        the bundle for this report