Class RatCheckMojo

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

    @Mojo(name="check",
          defaultPhase=VALIDATE)
    public class RatCheckMojo
    extends AbstractRatMojo
    Run Rat to perform a violation check.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String addLicenseHeaders
      Whether to add license headers; possible values are forced, true, and false (default).
      private boolean consoleOutput
      Whether to output the names of files that have unapproved licenses to the console.
      private java.lang.String copyrightMessage
      Copyright message to add to license headers.
      private boolean ignoreErrors
      Will ignore rat errors and display a log message if any.
      private int numUnapprovedLicenses
      Maximum number of files with unapproved licenses.
      private java.io.File reportFile
      Where to store the report.
      private java.lang.String reportStyle
      Output style of the report.
      • Fields inherited from interface org.apache.maven.plugin.Mojo

        ROLE
    • Constructor Summary

      Constructors 
      Constructor Description
      RatCheckMojo()  
    • Field Detail

      • reportFile

        @Parameter(property="rat.outputFile",
                   defaultValue="${project.build.directory}/rat.txt")
        private java.io.File reportFile
        Where to store the report.
      • reportStyle

        @Parameter(property="rat.outputStyle",
                   defaultValue="plain")
        private java.lang.String reportStyle
        Output style of the report. Use "plain" (the default) for a plain text report or "xml" for the raw XML report. Alternatively you can give the path of an XSL transformation that will be applied on the raw XML to produce the report written to the output file.
      • numUnapprovedLicenses

        @Parameter(property="rat.numUnapprovedLicenses",
                   defaultValue="0")
        private int numUnapprovedLicenses
        Maximum number of files with unapproved licenses.
      • addLicenseHeaders

        @Parameter(property="rat.addLicenseHeaders",
                   defaultValue="false")
        private java.lang.String addLicenseHeaders
        Whether to add license headers; possible values are forced, true, and false (default).
      • copyrightMessage

        @Parameter(property="rat.copyrightMessage")
        private java.lang.String copyrightMessage
        Copyright message to add to license headers. This option is ignored, unless addLicenseHeaders is set to true, or forced.
      • ignoreErrors

        @Parameter(property="rat.ignoreErrors",
                   defaultValue="false")
        private boolean ignoreErrors
        Will ignore rat errors and display a log message if any. Its use is NOT RECOMMENDED, but quite convenient on occasion.
        Since:
        0.9
      • consoleOutput

        @Parameter(property="rat.consoleOutput",
                   defaultValue="false")
        private boolean consoleOutput
        Whether to output the names of files that have unapproved licenses to the console.
        Since:
        0.12
    • Constructor Detail

      • RatCheckMojo

        public RatCheckMojo()
    • Method Detail

      • getRawReport

        private ClaimStatistic getRawReport()
                                     throws org.apache.maven.plugin.MojoExecutionException,
                                            org.apache.maven.plugin.MojoFailureException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
        org.apache.maven.plugin.MojoFailureException
      • getStyleSheet

        private java.io.InputStream getStyleSheet()
                                           throws org.apache.maven.plugin.MojoExecutionException
        Returns the XSL stylesheet to be used for formatting the report.
        Returns:
        report stylesheet, or null for raw XML
        Throws:
        org.apache.maven.plugin.MojoExecutionException - if the stylesheet can not be found
        See Also:
        reportStyle
      • execute

        public void execute()
                     throws org.apache.maven.plugin.MojoExecutionException,
                            org.apache.maven.plugin.MojoFailureException
        Invoked by Maven to execute the Mojo.
        Throws:
        org.apache.maven.plugin.MojoFailureException - An error in the plugin configuration was detected.
        org.apache.maven.plugin.MojoExecutionException - Another error occurred while executing the plugin.
      • check

        protected void check​(ClaimStatistic statistics)
                      throws org.apache.maven.plugin.MojoFailureException
        Throws:
        org.apache.maven.plugin.MojoFailureException
      • getConfiguration

        protected ReportConfiguration getConfiguration()
                                                throws org.apache.maven.plugin.MojoFailureException,
                                                       org.apache.maven.plugin.MojoExecutionException
        Overrides:
        getConfiguration in class AbstractRatMojo
        Throws:
        org.apache.maven.plugin.MojoFailureException
        org.apache.maven.plugin.MojoExecutionException