Apache RAT™ Overview
RAT audits software distributions, with a special interest in headers. If this isn't quite what you're looking for then take a look at the other products developed by Apache Creadur™, including Apache Whisker™ which audits and generates legal (for example LICENSE
) documents for complex software distributions.
The apache-rat-plugin
is used to run RAT in the Maven environment. It executes RAT report while providing standard Maven configuration options.
There are several things to keep in mind when running RAT
- RAT highlights possible issues.
- RAT reports require interpretation.
- RAT often requires some tuning before it runs well against a project.
- RAT relies on heuristics: it may miss issues
Usage
The RAT Maven plugin has two basic features.
apache-rat:check
will generate a report as a simple text file, called target/rat.txt
. This report contains the report as specified by the options specified.
apache-rat:report
will add the report to the generated site.
Writing the report to a text file
The apache-rat:check
goal creates a text file with the report. This is done by adding a section like the following to the pom.xml
:
<build> <plugins> ... <plugin> <groupId>org.apache.rat</groupId> <artifactId>apache-rat-plugin</artifactId> <version>0.17-SNAPSHOT</version> </plugin> ... </plugins> </build>
Once the plugin is specified the report can be generated from the command line by simply typing:
mvn apache-rat:check
We have provided an example of running the plugin automatically.
Adding the report to the generated site
A section like the following must be added to the pom.xml
to automatically generate the report when you run the site
target.
<reporting> <plugins> ... <plugin> <groupId>org.apache.rat</groupId> <artifactId>apache-rat-plugin</artifactId> <version>0.17-SNAPSHOT</version> </plugin> ... </plugins> </reporting>
Run the site
target.
mvn site
Configuration Options
There are a number of configuration options available to configure RAT. These options are derived from the command line version of RAT and function the same way.
Examples
The following examples should provide a better understanding of some usages of the RAT Maven Plugin.
- Basic use of the apache-rat:check goal.
- Automatically running the apache-rat:check goal when the project is built.
- Adding the report to the generated site.
- Applying a custom license.