Class RatReportMojo

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

    @Mojo(name="rat",
          requiresDependencyResolution=TEST)
    public class RatReportMojo
    extends AbstractRatMojo
    implements org.apache.maven.reporting.MavenReport
    Generates a report with Rat's output.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String DOT_HTML  
      private org.apache.maven.artifact.factory.ArtifactFactory factory  
      private org.apache.maven.artifact.repository.ArtifactRepository localRepository  
      private java.io.File outputDirectory
      Specifies the directory where the report will be generated
      private org.apache.maven.artifact.resolver.ArtifactResolver resolver  
      private org.apache.maven.doxia.siterenderer.Renderer siteRenderer  
      • 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
      RatReportMojo()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean canGenerateReport()
      Returns, whether the report may be generated.
      void execute()
      Called from Maven to invoke the plugin.
      void generate​(org.codehaus.doxia.sink.Sink sink, java.util.Locale locale)
      Writes the report to the Doxia sink.
      private java.util.ResourceBundle getBundle​(java.util.Locale locale)
      Returns the reports bundle
      java.lang.String getCategoryName()
      Returns the reports category name.
      java.lang.String getDescription​(java.util.Locale locale)
      Returns the reports description.
      java.lang.String getName​(java.util.Locale locale)
      Returns the reports name.
      java.lang.String getOutputName()
      Returns the reports file name.
      private java.lang.String getRatVersion()
      Searches for a Rat artifact in the dependency list and returns its version.
      java.io.File getReportOutputDirectory()
      Returns the reports output directory.
      private org.apache.maven.artifact.Artifact getSkinArtifactFile()
      Returns the skins artifact file.
      boolean isExternalReport()
      Returns, whether this is an external report.
      void setReportOutputDirectory​(java.io.File pOutputDirectory)
      Sets the reports output directory.
      • 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

      • siteRenderer

        @Component
        private org.apache.maven.doxia.siterenderer.Renderer siteRenderer
      • factory

        @Component
        private org.apache.maven.artifact.factory.ArtifactFactory factory
      • resolver

        @Component
        private org.apache.maven.artifact.resolver.ArtifactResolver resolver
      • outputDirectory

        @Parameter(defaultValue="${project.reporting.outputDirectory}",
                   required=true)
        private java.io.File outputDirectory
        Specifies the directory where the report will be generated
      • localRepository

        @Parameter(defaultValue="${localRepository}",
                   required=true,
                   readonly=true)
        private org.apache.maven.artifact.repository.ArtifactRepository localRepository
    • Constructor Detail

      • RatReportMojo

        public RatReportMojo()
    • Method Detail

      • getSkinArtifactFile

        private org.apache.maven.artifact.Artifact getSkinArtifactFile()
                                                                throws org.apache.maven.plugin.MojoFailureException,
                                                                       org.apache.maven.plugin.MojoExecutionException
        Returns the skins artifact file.
        Returns:
        Artifact file
        Throws:
        org.apache.maven.plugin.MojoFailureException - An error in the plugin configuration was detected.
        org.apache.maven.plugin.MojoExecutionException - An error occurred while searching for the artifact file.
      • execute

        public void execute()
                     throws org.apache.maven.plugin.MojoExecutionException,
                            org.apache.maven.plugin.MojoFailureException
        Called from Maven to invoke the plugin.
        Specified by:
        execute in interface org.apache.maven.plugin.Mojo
        Throws:
        org.apache.maven.plugin.MojoFailureException - An error in the plugin configuration was detected.
        org.apache.maven.plugin.MojoExecutionException - An error occurred while creating the report.
      • canGenerateReport

        public boolean canGenerateReport()
        Returns, whether the report may be generated.
        Specified by:
        canGenerateReport in interface org.apache.maven.reporting.MavenReport
        Returns:
        Always true.
      • getRatVersion

        private java.lang.String getRatVersion()
        Searches for a Rat artifact in the dependency list and returns its version.
        Returns:
        Version number, if found, or null.
      • generate

        public void generate​(org.codehaus.doxia.sink.Sink sink,
                             java.util.Locale locale)
                      throws org.apache.maven.reporting.MavenReportException
        Writes the report to the Doxia sink.
        Specified by:
        generate in interface org.apache.maven.reporting.MavenReport
        Parameters:
        sink - The doxia sink, kind of a SAX handler.
        locale - The locale to use for writing the report.
        Throws:
        org.apache.maven.reporting.MavenReportException - Writing the report failed.
      • getCategoryName

        public java.lang.String getCategoryName()
        Returns the reports category name.
        Specified by:
        getCategoryName in interface org.apache.maven.reporting.MavenReport
        Returns:
        MavenReport.CATEGORY_PROJECT_REPORTS
      • getBundle

        private java.util.ResourceBundle getBundle​(java.util.Locale locale)
        Returns the reports bundle
        Parameters:
        locale - Requested locale of the bundle
        Returns:
        The bundle, which is used to read localized strings.
      • getDescription

        public java.lang.String getDescription​(java.util.Locale locale)
        Returns the reports description.
        Specified by:
        getDescription in interface org.apache.maven.reporting.MavenReport
        Parameters:
        locale - Requested locale of the bundle
        Returns:
        Report description, as given by the key "report.rat.description" in the bundle.
      • getName

        public java.lang.String getName​(java.util.Locale locale)
        Returns the reports name.
        Specified by:
        getName in interface org.apache.maven.reporting.MavenReport
        Parameters:
        locale - Requested locale of the bundle
        Returns:
        Report name, as given by the key "report.rat.name" in the bundle.
      • getOutputName

        public java.lang.String getOutputName()
        Returns the reports file name.
        Specified by:
        getOutputName in interface org.apache.maven.reporting.MavenReport
        Returns:
        "rat-report"
      • getReportOutputDirectory

        public java.io.File getReportOutputDirectory()
        Returns the reports output directory.
        Specified by:
        getReportOutputDirectory in interface org.apache.maven.reporting.MavenReport
        Returns:
        Value of the "outputDirectory" parameter.
      • isExternalReport

        public boolean isExternalReport()
        Returns, whether this is an external report.
        Specified by:
        isExternalReport in interface org.apache.maven.reporting.MavenReport
        Returns:
        Always false.
      • setReportOutputDirectory

        public void setReportOutputDirectory​(java.io.File pOutputDirectory)
        Sets the reports output directory.
        Specified by:
        setReportOutputDirectory in interface org.apache.maven.reporting.MavenReport
        Parameters:
        pOutputDirectory - Reports target directory.