These examples assume you have installed the Rat Antlib in a way that provides the Report task in the XML namespace associated with the prefix rat
.
src
.<rat:report> <fileset dir="src"/> </rat:report>
The report will be written to Ant's logging system.
This corresponds to the command line
java -jar apache-rat-0.17-SNAPSHOT.jar src
except that Ant's default excludes will be applied when looking for documents to check.
<rat:report> <fileset dir="module1/src/main"/> <fileset dir="module2/src/test"/> </rat:report>
The equivalent of
java -jar apache-rat-0.17-SNAPSHOT.jar --edit-license --edit-copyright "Copyright 2008 Foo" /path/to/project
is
<rat:report editLicense="true" editCopyright="Copyright 2008 Foo"> <fileset dir="/path/to/project"/> </rat:report>
There are two types of styled reports, both are activated by using the "outputStyled" attribute on the "rat:report" element.
The first is the standard report type. This uses one of the standard reports shipped with Rat which are activated by setting the value of "outputStyled" to the name of the report.
An example using the "unapproved-licenses" styling and writing it to a file called "rat-unapproved.txt" is:
<rat:report outputStyle="unapproved-licenses" outputFile="rat-unapproved.txt"> <fileset dir="src"/> </rat:report>
The second type is the user defined XSLT. In this case the user provides the path to the xslt document as shown below. There is a report XSD and the standard report XSLT files are listed in the Rat Output documentation. In the example below the user has provided a "rat-xml-2-html.xslt" transformation and the output will be written to "rat.html"
<rat:report outputStyle="my/rat-xml-2-html.xslt" outputFile="rat.html"> <fileset dir="src"/> </rat:report>
<rat:report> <tarfileset> <gzipresource> <url url="http://example.org/some.tar.gz"/> </gzipresource> </tarfileset> </rat:report>
<rat:report addDefaultLicenseMatchers="false"> <fileset dir="src"/> <rat:asl20/> </rat:report>
src
that have been modified today<tstamp/> <rat:report xmlns:rat="antlib:org.apache.rat.anttasks"> <restrict> <fileset dir="src"/> <date when="after" datetime="${DSTAMP}" pattern="yyyyMMdd"/> </restrict> </rat:report>
Create a configuration file containing only your definition(s).
<rat:report addDefaultLicenseMatchers="false"> <fileset dir="src"/> <rat:config>YOUR_CONFIGURATION_FILE</rat:config> </rat:report>