Release Audit Tool (RAT)

Release Audit Tool (RAT) is a tool to improve accuracy and efficiency when checking releases. It is heuristic in nature: making guesses about possible problems. It will produce false positives and cannot find every possible issue with a release. It's reports require interpretation.

Running from the Command Line

Run from the command line with:

java -jar apache-rat-VERSION.jar --help

Where VERSION is replaced with the version number you are working with.

This will output a help message detailing the command line options available to you.

Adding licence headers

RAT can be used to automatically add licence headers to files that do not currently have them. Only files that are not excluded by the RAT configurations will be affected.

To add licence headers use a command such as:

java -jar apache-rat-VERSION.jar --addLicence
  --copyright "Copyright 2008 Foo" --force
  /path/to/project

This command will add the licence header directly to the source files. If you prefer to see which files will be changed and how then remove the "--force" option.

Using multiple excludes from a file

It is common to use the RAT with the maven or ant plugins and specify a series of files to exclude (such as a README or version control files). If you are using the RAT application instead of a plugin you can specify a series of regex excludes in a file and specify that with the -E option.

java -jar apache-rat-VERSION.jar
 -E /path/to/project/.rat-excludes
 -d /path/to/project

Command Line Options

usage: java rat.report [options] [DIR|TARBALL]
Options
 -A,--addLicense                Add the default licence header to any file
                                with an unknown licence that is not in the
                                exclusion list. By default new files will
                                be created with the licence header, to
                                force the modification of existing files
                                use the --force option.
 -a,--addLicence                Add the default licence header to any file
                                with an unknown licence that is not in the
                                exclusion list. By default new files will
                                be created with the licence header, to
                                force the modification of existing files
                                use the --force option.
 -c,--copyright <arg>           The copyright message to use in the
                                licence headers, usually in the form of
                                "Copyright 2008 Foo"
 -d,--dir                       Used to indicate source when using
                                --exclude
 -E,--exclude-file <fileName>   Excludes files matching regular expression
                                in <file> Note that --dir is required when
                                using this parameter.
 -e,--exclude <expression>      Excludes files matching wildcard
                                <expression>. Note that --dir is required
                                when using this parameter. Allows multiple
                                arguments.
 -f,--force                     Forces any changes in files to be written
                                directly to the source files (i.e. new
                                files are not created)
 -h,--help                      Print help for the RAT command line
                                interface and exit
 -s,--stylesheet <arg>          XSLT stylesheet to use when creating the
                                report.  Not compatible with -x
 -x,--xml                       Output the report in raw XML format.  Not
                                compatible with -s