blob: 02021cba8539eccaf67ab39c489d5366048df19f [file] [log] [blame]
<!DOCTYPE html>
<!--
| Generated by Apache Maven Doxia Site Renderer 1.11.1 from src/site/apt/index.apt.vm at 2024-01-08
| Rendered using Apache Maven Default Skin
-->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="generator" content="Apache Maven Doxia Site Renderer 1.11.1" />
<title>Apache Rat™ &#x2013; Command Line Support</title>
<link rel="stylesheet" href="./css/maven-base.css" />
<link rel="stylesheet" href="./css/maven-theme.css" />
<link rel="stylesheet" href="./css/site.css" />
<link rel="stylesheet" href="./css/print.css" media="print" />
<link href="https://fonts.googleapis.com/css?family=Mate+SC" type="text/css" rel="stylesheet" />
</head>
<body class="composite">
<div id="banner">
<a href="https://www.apache.org/" id="bannerLeft"><img src="https://www.apache.org/img/asf_logo.png" alt="The Apache Software Foundation" title="The Apache Software Foundation"/></a> <div class="clear">
<hr/>
</div>
</div>
<div id="breadcrumbs">
<div class="xleft">
<span id="publishDate">Last Published: 2024-01-08</span>
| <span id="projectVersion">Version: 0.16</span>
| <a href="https://www.apache.org/" class="externalLink" title="Apache">Apache</a> &gt;
<a href="https://creadur.apache.org/" class="externalLink" title="Creadur">Creadur</a> &gt;
<a href="https://creadur.apache.org/rat/" class="externalLink" title="Rat">Rat</a> &gt;
<a href="index.html" title="Apache Rat™">Apache Rat™</a> &gt;
Command Line Support
</div>
<div class="xright"> </div>
<div class="clear">
<hr/>
</div>
</div>
<div id="leftColumn">
<div id="navcolumn">
<h5>Parent Project</h5>
<ul>
<li class="none"><a href="../index.html" title="Apache Creadur Rat">Apache Creadur Rat</a></li>
</ul>
<h5>Project Documentation</h5>
<ul>
<li class="collapsed"><a href="project-info.html" title="Project Information">Project Information</a></li>
<li class="collapsed"><a href="project-reports.html" title="Project Reports">Project Reports</a></li>
</ul>
<h5>Apache Rat™</h5>
<ul>
<li class="none"><a href="../index.html" title="Introducing Rat">Introducing Rat</a></li>
<li class="none"><a href="../apidocs/index.html" title="Javadocs">Javadocs</a></li>
<li class="none"><a href="../download_rat.cgi" title="Downloads">Downloads</a></li>
<li class="none"><a href="../RELEASE_NOTES.txt" title="Changes">Changes</a></li>
</ul>
<h5>Running Rat</h5>
<ul>
<li class="none"><a href="../apache-rat/index.html" title="From The Command Line">From The Command Line</a></li>
<li class="none"><a href="../apache-rat-tasks/index.html" title="With Ant">With Ant</a></li>
<li class="none"><a href="../apache-rat-plugin/index.html" title="With Maven">With Maven</a></li>
</ul>
<h5>Apache Creadur™</h5>
<ul>
<li class="none"><a href="https://creadur.apache.org" class="externalLink" title="Creadur Project Home">Creadur Project Home</a></li>
<li class="none"><a href="https://creadur.apache.org/tentacles" class="externalLink" title="Apache Tentacles">Apache Tentacles</a></li>
<li class="none"><a href="https://creadur.apache.org/whisker" class="externalLink" title="Apache Whisker">Apache Whisker</a></li>
<li class="none"><a href="https://www.apache.org/security/" class="externalLink" title="Security">Security</a></li>
<li class="none"><a href="https://www.apache.org/licenses/" class="externalLink" title="License">License</a></li>
<li class="none"><a href="https://www.apache.org/foundation/sponsorship.html" class="externalLink" title="Sponsorship">Sponsorship</a></li>
<li class="none"><a href="https://www.apache.org/foundation/thanks.html" class="externalLink" title="Thanks">Thanks</a></li>
</ul>
<h5>The Apache Software Foundation</h5>
<ul>
<li class="none"><a href="https://www.apache.org/foundation" class="externalLink" title="About the Foundation">About the Foundation</a></li>
<li class="none"><a href="https://projects.apache.org" class="externalLink" title="The projects">The projects</a></li>
<li class="none"><a href="https://people.apache.org" class="externalLink" title="The people">The people</a></li>
<li class="none"><a href="https://www.apache.org/foundation/how-it-works.html" class="externalLink" title="How we work">How we work</a></li>
<li class="none"><a href="https://www.apache.org/foundation/how-it-works.html#history" class="externalLink" title="Our history">Our history</a></li>
<li class="none"><a href="https://blogs.apache.org/foundation/" class="externalLink" title="News">News</a></li>
</ul>
<h5>Contribute</h5>
<ul>
<li class="none"><a href="https://www.apache.org/foundation/getinvolved.html" class="externalLink" title="Get Involved">Get Involved</a></li>
</ul>
<h5>Committer Info</h5>
<ul>
<li class="none"><a href="https://www.apache.org/dev/committers.html" class="externalLink" title="ASF Committers' FAQ">ASF Committers' FAQ</a></li>
<li class="none"><a href="https://www.apache.org/dev/new-committers-guide.html" class="externalLink" title="New Committers Guide">New Committers Guide</a></li>
<li class="none"><a href="../site-publish.html" title="Howto publish this site">Howto publish this site</a></li>
<li class="none"><a href="https://community.apache.org/" class="externalLink" title="Community">Community</a></li>
<li class="none"><a href="https://www.apache.org/legal/" class="externalLink" title="Legal">Legal</a></li>
<li class="none"><a href="https://www.apache.org/foundation/marks/" class="externalLink" title="Branding">Branding</a></li>
<li class="none"><a href="https://www.apache.org/press/" class="externalLink" title="Media Relations">Media Relations</a></li>
</ul>
<a href="https://maven.apache.org/" title="Maven" class="poweredBy">
<img class="poweredBy" alt="Maven" src="https://maven.apache.org/images/logos/maven-feather.png" />
</a>
</div>
</div>
<div id="bodyColumn">
<div id="contentBox">
<section>
<h2><a name="About_Apache_Rat.26.238482.3B"></a>About Apache Rat&#8482;</h2>
<p>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 <a class="externalLink" href="https://creadur.apache.org">Apache Creadur</a>&#8482;, including <a class="externalLink" href="https://creadur.apache.org/whisker">Apache Whisker</a>&#8482; which audits and generates legal (for example <code>LICENSE</code>) documents for complex software distributions.</p><section>
<h3><a name="Running_from_the_Command_Line"></a>Running from the Command Line</h3>
<p>Run from the command line with:</p>
<div class="source">
<pre>java -jar apache-rat/target/apache-rat-0.16.jar --help</pre></div>
<p>This will output a help message detailing the command line options available to you.</p></section><section>
<h3><a name="Adding_license_headers"></a>Adding license headers</h3>
<p>Rat can be used to automatically add license headers to files that do not currently have them. Only files that are not excluded by the Rat configurations will be affected.</p>
<p>To add license headers use a command such as:</p>
<div class="source">
<pre>java -jar apache-rat/target/apache-rat-0.16.jar --addlicense
--copyright &quot;Copyright 2008 Foo&quot; --force
/path/to/project</pre></div>
<p>This command will add the license header directly to the source files. If you prefer to see which files will be changed and how then remove the &quot;--force&quot; option.</p></section><section>
<h3><a name="Using_multiple_excludes_from_a_file"></a>Using multiple excludes from a file</h3>
<p>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.</p>
<div class="source">
<pre>java -jar apache-rat/target/apache-rat-0.16.jar
-E /path/to/project/.rat-excludes
-d /path/to/project</pre></div></section><section>
<h3><a name="Command_Line_Options"></a>Command Line Options</h3>
<div class="source">
<pre>usage: java -jar apache-rat/target/apache-rat-0.16.jar
[options] [DIR|TARBALL]
Available options
-a,--addLicence Add the default license header to any file
with an unknown license 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 --force option.
-A,--addLicense Add the default license header to any file
with an unknown license 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 --force option.
-c,--copyright &lt;arg&gt; The copyright message to use in the
license headers, usually in the form of
&quot;Copyright 2008 Foo&quot;
-d,--dir Used to indicate source when using
--exclude
-e,--exclude &lt;expression&gt; Excludes files matching wildcard
&lt;expression&gt;. Note that --dir is required
when using this parameter. Allows multiple
arguments.
-E,--exclude-file &lt;fileName&gt; Excludes files matching regular expression
in &lt;file&gt; Note that --dir is required when
using this parameter.
-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
--licenses &lt;arg&gt; File names or URLs for license definitions
--list-approved-families List all defined license families
--list-licenses List all active licenses
--no-default-licenses Ignore default configuration. By default
all approved default licenses are used
-o,--out &lt;arg&gt; Define the output file where to write
report (default is System.out)
-s,--stylesheet &lt;arg&gt; XSLT stylesheet to use when creating the
report. Not compatible with -x
--scan-hidden-directories Scan hidden directories
-x,--xml Output the report in raw XML format. Not
compatible with -s</pre></div></section></section>
</div>
</div>
<div class="clear">
<hr/>
</div>
<div id="footer">
<div class="xright">
Copyright &copy; 2016-2023 The Apache Software Foundation, Licensed under the Apache License, Version 2.0.
Apache Creadur, Creadur, Apache Rat, Apache Tentacles, Apache Whisker, Apache and the Apache feather logo are trademarks
of The Apache Software Foundation.
Oracle and Java are registered trademarks of Oracle and/or its affiliates.
All other marks mentioned may be trademarks or registered trademarks of their respective owners.
</div>
<div class="clear">
<hr/>
</div>
</div>
</body>
</html>