blob: 5d656147be4fab4ec7b7650546a293ac78847bf0 [file]
<!DOCTYPE html>
<!--
| Generated by Apache Maven Doxia Site Renderer 2.0.0 from src/site/markdown/development/ui/ui_specific.md at 2026-03-22
| Rendered using Apache Maven Fluido Skin 2.1.0
-->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="generator" content="Apache Maven Doxia Site Renderer 2.0.0" />
<title>The UI specific code – Apache RAT™ - A Release Audit Tool</title>
<link rel="stylesheet" href="../../css/apache-maven-fluido-2.1.0.min.css" />
<link rel="stylesheet" href="../../css/site.css" />
<link rel="stylesheet" href="../../css/print.css" media="print" />
<script src="../../js/apache-maven-fluido-2.1.0.min.js"></script>
<link href="https://creadur.apache.org/font/matesc.css" type="text/css" rel="stylesheet" />
</head>
<body>
<a class="github-fork-ribbon right-top" href="https://github.com/apache/creadur-rat" data-ribbon="Fork me on GitHub">Fork me on GitHub</a>
<div class="container-fluid container-fluid-top">
<header>
<div id="banner">
<div class="pull-left"><div id="bannerLeft"><h1><a href="https://www.apache.org/"><img src="https://www.apache.org/img/asf_logo.png" alt="The Apache Software Foundation" /> Apache RAT</a></h1></div></div>
<div class="pull-right"></div>
<div class="clear"><hr/></div>
</div>
<div id="breadcrumbs">
<ul class="breadcrumb">
<li id="publishDate">Last Published: 2026-03-22<span class="divider">|</span>
</li>
<li id="projectVersion">Version: 1.0.0-SNAPSHOT<span class="divider">|</span></li>
<li><a href="https://www.apache.org/">Apache</a><span class="divider">/</span></li>
<li><a href="../../../">Creadur</a><span class="divider">/</span></li>
<li><a href="../.././">RAT</a><span class="divider">/</span></li>
<li class="active">The UI specific code</li>
</ul>
</div>
</header>
<div class="row-fluid">
<header id="leftColumn" class="span2">
<nav class="well sidebar-nav">
<ul class="nav nav-list">
<li class="nav-header">Apache RAT™</li>
<li><a href="../../index.html">Introducing RAT</a></li>
<li><a href="../../download_rat.cgi">Downloads</a></li>
<li><a href="../../changes.html">Changes</a></li>
<li><a href="../../apache-rat/known_issues.html">Known Issues</a></li>
<li><a href="../../apache-rat/migration_guide.html">Migration Guide</a></li>
<li class="nav-header">RAT from the Command Line</li>
<li><a href="../../apache-rat/index.html">Command Line Introduction</a></li>
<li><a href="../../apache-rat/cli_options.html">Command Line Options</a></li>
<li><a href="../../apache-rat/env_vars.html">Environment Variables</a></li>
<li><a href="../../apache-rat-core/exclusion_expression.html">Exclusion Expressions</a></li>
<li><a href="../../apache-rat/standard_collections.html">Standard Collections</a></li>
<li class="nav-header">RAT from Ant</li>
<li><a href="../../apache-rat-tasks/index.html">Ant Task Introduction</a></li>
<li><a href="../../apache-rat-tasks/ant_options.html">Ant Elements and Attributes</a></li>
<li class="nav-header">RAT from Maven</li>
<li><a href="../../apache-rat-plugin/index.html">Maven Plugin Introduction</a></li>
<li><a href="../../apache-rat-plugin/mvn_options.html">Maven Options</a></li>
<li><a href="../../apache-rat-plugin/examples/index.html">Maven Examples</a></li>
<li class="nav-header">Configuring RAT</li>
<li><a href="../../apache-rat/name_xref.html">Option Name Cross Reference</a></li>
<li><a href="../../apache-rat/default_licenses.html">Default Licenses</a></li>
<li><a href="../../apache-rat/default_matchers.html">Default Matchers</a></li>
<li><a href="../../license_def.html">Defining New Licenses</a></li>
<li><a href="../../apache-rat/xsd.html">Configuration XSD</a></li>
<li><a href="https://gitbox.apache.org/repos/asf/creadur-rat/blob/master/apache-rat-core/src/main/resources/org/apache/rat/default.xml">Default Configuration</a></li>
<li><a href="../../apache-rat/detecting_generated_files.html">Detecting Generated Files</a></li>
<li class="nav-header">RAT Output</li>
<li><a href="../../apache-rat/output/example.html">Standard Output Example</a></li>
<li><a href="https://gitbox.apache.org/repos/asf/creadur-rat/blob/master/apache-rat-core/src/main/resources/org/apache/rat/rat-report.xsd">Output XSD</a></li>
<li><a href="https://gitbox.apache.org/repos/asf/creadur-rat/blob/master/apache-rat-core/src/main/resources/org/apache/rat/plain-rat.xsl">XSLT - Plain text</a></li>
<li><a href="https://gitbox.apache.org/repos/asf/creadur-rat/blob/master/apache-rat-core/src/main/resources/org/apache/rat/missing-headers.xsl">XSLT - Missing headers list</a></li>
<li><a href="https://gitbox.apache.org/repos/asf/creadur-rat/blob/master/apache-rat-core/src/main/resources/org/apache/rat/unapproved-licenses.xsl">XSLT - Unapproved licenses list</a></li>
<li class="nav-header">Developing RAT</li>
<li><a href="../../architecture.html">Architecture</a></li>
<li><a href="../../apidocs/index.html">Javadocs</a></li>
<li><a href="../../apache-rat-core/development/document_name.html">Document Name concept</a></li>
<li><a href="../../development/ui_implementation.html">UI Development</a></li>
<li><a href="../../apache-rat-core/development/write_file_processor.html">Writing a File Processor</a></li>
<li class="nav-header">Apache Creadur™</li>
<li><a href="../../..">Creadur Project Home</a></li>
<li><a href="../../../tentacles">Apache Tentacles</a></li>
<li><a href="../../../whisker">Apache Whisker</a></li>
<li><a href="https://www.apache.org/security/">Security</a></li>
<li><a href="https://www.apache.org/licenses/">License</a></li>
<li><a href="https://privacy.apache.org/policies/privacy-policy-public.html">Privacy</a></li>
<li><a href="https://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li>
<li><a href="https://www.apache.org/foundation/thanks.html">Thanks</a></li>
<li class="nav-header">The Apache Software Foundation</li>
<li><a href="https://www.apache.org/foundation">About the Foundation</a></li>
<li><a href="https://projects.apache.org">The projects</a></li>
<li><a href="https://people.apache.org">The people</a></li>
<li><a href="https://www.apache.org/foundation/how-it-works.html">How we work</a></li>
<li><a href="https://www.apache.org/foundation/how-it-works.html#history">Our history</a></li>
<li><a href="https://blogs.apache.org/foundation/">News</a></li>
<li class="nav-header">Contribute</li>
<li><a href="https://www.apache.org/foundation/getinvolved.html">Get Involved</a></li>
<li class="nav-header">Committer Info</li>
<li><a href="https://www.apache.org/dev/committers.html">ASF Committers&apos; FAQ</a></li>
<li><a href="https://www.apache.org/dev/new-committers-guide.html">New Committers Guide</a></li>
<li><a href="https://gitbox.apache.org/repos/asf/creadur-site/blob/asf-site/README.md">How to publish this site</a></li>
<li><a href="https://community.apache.org/">Community</a></li>
<li><a href="https://www.apache.org/legal/">Legal</a></li>
<li><a href="https://www.apache.org/foundation/marks/">Branding</a></li>
<li><a href="https://www.apache.org/press/">Media Relations</a></li>
<li class="nav-header">Modules</li>
<li><a href="../../apache-rat-core/index.html">Apache Creadur RAT::Core</a></li>
<li><a href="../../apache-rat-plugin/index.html">Apache Creadur RAT::Plugin4Maven</a></li>
<li><a href="../../apache-rat-tasks/index.html">Apache Creadur RAT::Tasks4Ant</a></li>
<li><a href="../../apache-rat/index.html">Apache Creadur RAT::Packaging</a></li>
<li><a href="../../apache-rat-tools/index.html">Apache Creadur RAT::Tools</a></li>
<li><a href="../../apache-rat-testdata/index.html">Apache Creadur RAT::Testdata</a></li>
<li class="nav-header">Project Documentation</li>
<li><a href="../../project-info.html"><span class="icon-chevron-right"></span>Project Information</a></li>
<li><a href="../../project-reports.html"><span class="icon-chevron-right"></span>Project Reports</a></li>
</ul>
</nav>
<div class="well sidebar-nav">
<div id="poweredBy">
<div class="clear"></div>
<div class="clear"></div>
<a href="https://maven.apache.org/" class="builtBy"><img class="builtBy" src="https://maven.apache.org/images/logos/maven-feather.png" /> Maven</a>
</div>
</div>
</header>
<main id="bodyColumn" class="span10">
<!---
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<section><a id="The_UI_specific_code"></a>
<h1>The UI specific code</h1>
<blockquote>
<p>Up: <a href="../ui_implementation.html">UI Implementation</a>
<br /><a href="./options.html">Options</a> | <a href="./generator.html">Generator</a> | UI Specific</p>
</blockquote>
<p>In most cases the UI provides values for some of the CLI options, or have additional options that are not supported by CLI.
In the case of Maven there is a &#x201c;skip&#x201d; option that causes the Maven plugin to not execute.
This is not implemented in the CLI as it is assumed if you don't want to execute the CLI you won't call it.</p>
<p>The <code>apache-rat-plugin</code> contains the code for the Maven UI extension. In this particular case there are three components that extend the generated abstract class:</p>
<ol style="list-style-type: decimal;">
<li><code>AbstractRatMojo</code> - extends the generated class and adds standard functionality.</li>
<li><code>RatCheckMojo</code> - extends <code>AbstractRatMojo</code> and adds the functionality to execute the RAT core <code>Reporter</code> class.</li>
<li><code>RatReportMojo</code> - extends <code>AbstractRatMojo</code> and adds the functionality to provide reports into the Maven reporting system.</li>
</ol><section><a id="Added_.2F_Modified_functionality"></a>
<h2>Added / Modified functionality</h2><section><a id="Logging"></a>
<h3>Logging</h3>
<p>Most UIs have some process for logging. RAT defines a <a href="https://github.com/apache/creadur-rat/blob/master/apache-rat-core/src/main/java/org/apache/rat/utils/Log.java" class="externalLink">Log</a> interface and uses the <a href="https://github.com/apache/creadur-rat/blob/master/apache-rat-core/src/main/java/org/apache/rat/utils/DefaultLog.java" class="externalLink">DefaultLog</a> class to track the instance.</p>
<p>The <code>AbstractRatMojo</code> class has a <code>makeLog</code> method that wraps the Maven log to create an instance of the RAT Log interface.
In the <code>getConfiguration</code> method the DefaultLog default is set to return the wrapped Maven log.</p></section><section><a id="Processing_Arguments"></a>
<h3>Processing Arguments</h3>
<p>The <code>AbstractRatMojo.getConfiguration</code> performs some changes to the args defined in generated base class, generates the configuration and then calls:</p>
<pre class="prettyprint"><code class="language-java">ReportConfiguration config = OptionCollection.parseCommands(args().toArray(new String[0]),
o -&gt; getLog().warn(&quot;Help option not supported&quot;),
true);
</code></pre>
<p>The above line creates the configuration from the args and if the user somehow manages to call help will log a warning that help is not supported.</p>
<p>After the <code>ReportConfiguration</code> is created it is modified based on specific Maven command line options before it is returned to the calling method.</p></section></section><section><a id="Executing_the_RAT_scan"></a>
<h2>Executing the RAT scan</h2>
<p>The Maven code executes the RAT scan in the <code>RatCheckMojo.execute()</code> method.
This method processes the Maven &#x201c;skip&#x201d; option, checks if the output is overridden in the Args structure and if not sets the Maven default, retrieves the configuration and executes:</p>
<pre class="prettyprint"><code class="language-java">try {
this.reporter = new Reporter(config);
reporter.output();
check();
} catch (MojoFailureException e) {
throw e;
} catch (Exception e) {
throw new MojoExecutionException(e.getMessage(), e);
}
</code></pre>
<p>The <code>check()</code> method performs custom checks and logging for Maven specific issues.</p></section><section><a id="Ant_processing"></a>
<h2>Ant processing</h2>
<p>The Ant processing is performed by the <code>Report</code> class in the <code>apache-rat-tasks</code> module.
It follows the same basic processing path as the Maven processing except that it handle Ant specific requirements and options.
The class has an <code>execute()</code> method that looks very similar to the Maven version:</p>
<pre class="prettyprint"><code class="language-java">try {
Reporter r = new Reporter(validate(getConfiguration()));
r.output(StyleSheets.PLAIN.getStyleSheet(), () -&gt; new ReportConfiguration.NoCloseOutputStream(System.out));
r.output();
} catch (BuildException e) {
throw e;
} catch (Exception ioex) {
throw new BuildException(ioex);
}
</code></pre>
<blockquote>
<p>Up: <a href="../ui_implementation.html">UI Implementation</a>
<br /><a href="./options.html">Options</a> | <a href="./generator.html">Generator</a> | UI Specific</p>
</blockquote></section></section> </main>
</div>
</div>
<hr/>
<footer>
<div class="container-fluid">
<div class="row-fluid">
Copyright &copy; 2016-2025 The Apache Software Foundation, Licensed under the Apache License, Version 2.0.
Apache Creadur, Creadur, Apache RAT, Apache Tentacles, Apache Whisker, Apache and the ASF 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>
</footer>
</body>
</html>