Usage

To use the plugin, you've got two options: First of all, it can create a simple text file, called target/rat.txt, with the plugin's output. This is done by invoking the apache-rat:check goal.

You may also add a report to the generated site. This is your second option.

Writing the report to a text file

To create a text file with the report, you need to run the apache-rat:check goal. Add a section like the following to your POM:

  <build>
    <plugins>
      ...
      <plugin>
        <groupId>org.apache.rat</groupId>
        <artifactId>apache-rat-plugin</artifactId>
        <version>0.17-SNAPSHOT</version>
      </plugin>
      ...
    </plugins>
  </build>

Once you have done that, the plugin can be run from the command line by simply typing

  mvn apache-rat:check

An example for running the plugin automatically can be found here.

Adding the report to the generated site

A section like the following must be added to your POM:

  <reporting>
    <plugins>
      ...
      <plugin>
        <groupId>org.apache.rat</groupId>
        <artifactId>apache-rat-plugin</artifactId>
        <version>0.17-SNAPSHOT</version>
      </plugin>
      ...
    </plugins>
  </reporting>

The report will be created automatically when you generate the site:

  mvn site

Options

The Rat Maven plugin has a number of options as is shown in the table below.

Maven                          Description                                                          Argument Type       

<editCopyright>                The copyright message to use in the license headers. Usually in the  String              
                                 form of "Copyright 2008 Foo".  Only valid with <editLicense>                           

<editOverwrite>                Forces any changes in files to be written directly to the source     -- none --          
                                 files (i.e. new files are not created). Only valid with                                
                                 <editLicense>                                                                          

<editLicense>                  Add the default license header to any file with an unknown license   -- none --          
                                 that is not in the exclusion list. By default new files will be                        
                                 created with the license header, to force the modification of                          
                                 existing files use the <editOverwrite> option.                                         

<config>                       File names for system configuration.                                 File                

<configurationNoDefaults>      Ignore default configuration.                                        -- none --          

<licensesApproved>             The approved License IDs. These licenses will be added to the list   LicenseID           
                                 of approved licenses.                                                                  

<licensesApprovedFile>         Name of file containing the approved License IDs.                    File                

<licenseFamiliesApproved>      The approved License Family IDs. These licenses families will be     FamilyID            
                                 added to the list of approved licenses families.                                       

<licenseFamiliesApprovedFile>  Name of file containing the approved family IDs.                     File                

<licensesDenied>               The denied License IDs. These licenses will be removed from the      LicenseID           
                                 list of approved licenses. Once licenses are removed they can not                      
                                 be added back.                                                                         

<licensesDeniedFile>           Name of file containing the denied license IDs.                      File                

<licenseFamiliesDenied>        The denied License family IDs. These license families will be        FamilyID            
                                 removed from the list of approved licenses.                                            

<licenseFamiliesDeniedFile>    Name of file containing the denied license IDs.                      File                

<inputExclude>                 Excludes files matching <Expression>.                                Expression          

<inputExcludeFile>             Reads <Expression> entries from a file. Entries will be excluded     File                
                                 from processing.                                                                       

<inputExcludeStd>              Excludes files defined in standard collections based on commonly     StandardCollection  
                                 occurring groups.                                                                      

<inputInclude>                 Includes files matching <Expression>. Will override excluded files.  Expression          

<inputIncludeFile>             Reads <Expression> entries from a file. Entries will override        File                
                                 excluded files.                                                                        

<inputIncludeStd>              Includes files defined in standard collections based on commonly     StandardCollection  
                                 occurring groups. Will override excluded files.                                        

<inputExcludeParsedScm>        Parse SCM based exclusion files to exclude specified files and       StandardCollection  
                                 directories.                                                                           

<outputStyle>                  XSLT stylesheet to use when creating the report. Either an external  StyleSheet          
                                 xsl file may be specified or one of the internal named sheets.                         

<outputLicenses>               List the defined licenses.                                           LicenseFilter       

<outputFamilies>               List the defined license families.                                   LicenseFilter       

-- not supported --            sets the log level.                                                  LogLevel            

<dryRun>                       If set do not update the files but generate the reports.             -- none --          

<outputFile>                   Define the output file where to write a report to.                   File                

<outputArchive>                Specifies the level of detail in ARCHIVE file reporting.             ProcessingType      

<outputStandard>               Specifies the level of detail in STANDARD file reporting.            ProcessingType      

<helpLicenses>                 Print information about registered licenses.                         -- none --          

-- not supported --            Print help for the RAT command line interface and exit.              -- none --          

Argument Types

The Rat maven plugin uses the standard argument types as shown below.

<DirOrArchive>
     A directory or archive file to scan.

<Expression>
     A file matching pattern usually of the form used in Ant build files and '.gitignore' files (see
         https://ant.apache.org/manual/dirtasks.html#patterns for examples). Regular expression patterns may be
         specified by surrounding the pattern with '%regex[' and ']'. For example '%regex[[A-Z].*]' would match files
         and directories that start with uppercase latin letters.

<FamilyID>
     The ID for a license family.

<File>
     A file name.

<LicenseFilter>
     A defined filter for the licenses to include. Valid values: ALL, APPROVED, NONE.

<LicenseID>
     The ID for a license.

<LogLevel>
     The log level to use. Valid values DEBUG, INFO, WARN, ERROR, OFF.

<ProcessingType>
     Specifies how to process file types. Valid values are:
         NOTIFICATION: List file as present

         PRESENCE: List any licenses found

         ABSENCE: List licenses found and any unknown licences

<StandardCollection>
     Defines standard expression patterns (see above). Valid values are:
         ALL: All of the Standard Excludes combined.

         ARCH: The files and directories created by an ARCH source code control based tool.

         BAZAAR: The files and directories created by a Bazaar source code control based tool.

         BITKEEPER: The files and directories created by a Bitkeeper source code control based tool.

         CVS: The files and directories created by a CVS source code control based tool.

         DARCS: The files and directories created by a DARCS source code control based tool.

         ECLIPSE: The files and directories created by an Eclipse IDE based tool.

         GIT: The files and directories created by GIT source code control to support GIT, also processes files listed
         in '.gitignore'.

         HIDDEN_DIR: The hidden directories. Directories with names that start with '.'

         HIDDEN_FILE: The hidden files. Directories with names that start with '.'

         IDEA: The files and directories created by an IDEA IDE based tool.

         MAC: The .DS_Store files MAC computer.

         MAVEN: The files and directories created by Maven build system based project.

         MERCURIAL: The files and directories created by a Mercurial source code control based tool.

         MISC: The set of miscellaneous files generally left by editors and the like.

         MKS: The files and directories created by an MKS source code control based tool.

         RCS: The files and directories created by a RCS source code control based tool.

         SCCS: The files and directories created by a SCCS source code control based tool.

         SERENA_DIMENSIONS_10: The files and directories created by a Serena Dimensions V10 change control system based
         tool.

         STANDARD_PATTERNS: A standard collection of generally accepted patterns to ignore.

         STANDARD_SCMS: A standard collection of SCMs

         SUBVERSION: The files and directories created by a Subversion source code control based tool.

         SURROUND_SCM: The files and directories created by a Surround SCM source code control based tool.

         VSS: The files and directories created by a Visual Source Safe source code control based tool.

<StyleSheet>
     Either an external xsl file or one of the internal named sheets. Internal sheets are:
         plain-rat: The default style.

         missing-headers: Produces a report of files that are missing headers.

         unapproved-licenses: Produces a report of the files with unapproved licenses.

         xml: Produces output in pretty-printed XML.