source: release-kits/lirk3/resources/gs3-release-maker/apache-ant-1.6.5/docs/manual/OptionalTasks/maudit.html@ 14982

Last change on this file since 14982 was 14982, checked in by oranfry, 16 years ago

initial import of LiRK3

File size: 5.7 KB
Line 
1<html>
2
3<head>
4<meta http-equiv="Content-Language" content="en-us">
5<title>MAudit Task</title>
6<link rel="stylesheet" type="text/css" href="../stylesheets/antmanual.css">
7</head>
8
9<body>
10
11<h2><a name="maudit">MAudit</a></h2>
12<ul>
13 <li>Stephane Bailliez (<a href="mailto:[email protected]">[email protected]</a>)</li>
14</ul>
15<h3>Requirements</h3>
16<p>This task requires Metamata Development environment 2.0/Webgain Quality Analyzer 2.0.
17An evaluation version is available at <a href="http://www.webgain.com/products/quality_analyzer/">Webgain</a>.
18, <a href="http://jakarta.apache.org/oro/">Jakarta Oro</a> and a XML parser (via JAXP).</p>
19<h3>Description</h3>
20<p>
21 Invokes the Metamata Audit/ Webgain Quality Analyzer on a set of Java files.
22</p>
23<p>
24 <i>maudit</i> performs static analysis of the Java source code and byte code files to find and report
25 errors of style and potential problems related to performance, maintenance and robustness.
26. As a convenience, a stylesheet is given in <tt>etc</tt> directory, so that an HTML report can be generated from the XML file.
27</p>
28
29<h3>Parameters</h3>
30<table border="1" cellpadding="2" cellspacing="0">
31 <tr>
32 <td valign="top"><b>Attribute</b></td>
33 <td valign="top"><b>Description</b></td>
34 <td align="center" valign="top"><b>Required</b></td>
35 </tr>
36 <tr>
37 <td valign="top">tofile</td>
38 <td valign="top">The XML file to which the Audit result should be written to.</td>
39 <td valign="top" align="center">Yes</td>
40 </tr>
41 <tr>
42 <td valign="top">metamatahome</td>
43 <td valign="top">The home directory containing the Metamata distribution.</td>
44 <td valign="top" align="center">Yes</td>
45 </tr>
46 <tr>
47 <td valign="top">fix</td>
48 <td valign="top">
49 Automatically fix certain errors (those marked as fixable in the manual).
50 </td>
51 <td valign="top" align="center">No.Default to false.</td>
52 </tr>
53 <tr>
54 <td valign="top">list</td>
55 <td valign="top">
56 Creates listing file for each audited file. A .maudit file will be generated in the
57 same location as the source file.
58 </td>
59 <td valign="top" align="center">No. Default to false.</td>
60 </tr>
61 <tr>
62 <td valign="top">unused</td>
63 <td valign="top">
64 Finds declarations unused in search paths. It will look for unused global declarations
65 in the source code within a use domain specified by the <tt>searchpath</tt> element.
66 </td>
67 <td valign="top" align="center">No. Default to false.</td>
68 </tr>
69 <tr>
70 <td valign="top">maxmemory</td>
71 <td valign="top">Set the maximum memory for the JVM. this is a convenient
72 way to set the -mx or -Xmx argument.</td>
73 <td valign="top" align="center">No</td>
74 </tr>
75</table>
76<h3>Nested elements</h3>
77<h4>jvmarg</h4>
78<p>Additional parameters may be passed to the VM via nested <code>&lt;jvmarg&gt;</code>
79attributes. <code>&lt;jvmarg&gt;</code> allows all attributes described in
80<a href="../using.html#arg">Command line arguments</a>.</p>
81<p>
82You can avoid using the <code>&lt;jvmarg&gt;</code> by adding these empty
83entries to <code>metamata.properties</code> located at <code>${metamata.home}/bin</code>
84</p>
85<pre>metamata.classpath=
86metamata.sourcepath=
87metamata.baseclasspath=
88</pre>
89</p>
90<h4>classpath</h4>
91<p>Sets class path (also source path unless one explicitly set). Overrides
92METAPATH/CLASSPATH environment variables. The <tt>classpath</tt> element represents a <a href="../using.html#path">PATH like
93structure</a>.</p>
94<h4>sourcepath</h4>
95<p>Sets source path. Overrides the SOURCEPATH environment variable. The <tt>sourcepath</tt> element represents a <a href="../using.html#path">PATH like
96structure</a>.</p>
97<h4>sourcepath</h4>
98<p>Sets the search path to use as the use domain when looking for unused global declarations. The <tt>searchpath</tt> element represents a <a href="../using.html#path">PATH like
99structure</a>.</p>
100<h4>fileset</h4>
101<p>Sets the Java files to audit via a <a href="../CoreTypes/fileset.html">FILESET</a> structure.
102Whatever the filter is, only the files that ends with <i>.java</i> will be included for processing.
103Note that the base directory used for the fileset MUST be the root of the source files otherwise
104package names deduced from the file path will be incorrect.
105</p>
106<h3>Example</h3>
107<pre> &lt;maudit tofile=&quot;c:/metamata/examples/auditexamples/audit.xml&quot;
108 metamatahome=&quot;c:/metamata&quot; fix=&quot;yes&quot;&gt;
109 &lt;classpath&gt;
110 &lt;pathelement location=&quot;c:/metamata/examples/auditexamples&quot;/&gt;
111 &lt;/classpath&gt;
112 &lt;sourcepath&gt;
113 &lt;pathelement location=&quot;c:/metamata/examples/auditexamples&quot;/&gt;
114 &lt;/sourcepath&gt;
115 &lt;fileset dir=&quot;c:/metamata/examples/auditexamples&quot;&gt;
116 &lt;include name=&quot;*.java&quot;/&gt;
117 &lt;/fileset&gt;
118 &lt;/maudit&gt;</pre>
119<p>
120 This invokes Metamata Audit installed in <tt>c:/metamata</tt> on the audit examples
121and fix automatically the fixable errors.
122</p>
123<h3>Generating a report</h3>
124As a convenience, there is an XSL file(mmetrics-frames.xsl) that allows you to generate a full framed HTML report of the metrics.
125You can find it in the <i>etc</i> directory of Ant. As it uses the Xalan redirect extensions, you will need Xalan and Xerces to run it.
126The stylesheet takes an <i>output.dir</i> parameter (otherwise it will be generated
127in the current directory), it can be run in Ant as follows:
128<pre>
129&lt;style in=java &quot;${audit.xml}&quot; style=&quot;maudit-frames.xsl&quot; out="null.tmp"&gt;
130 &lt;param name=&quot;output.dir&quot; expression=&quot;${report.dir}&quot;/&gt;
131&lt;/style&gt;
132</pre>
133
134<hr>
135<p align="center">Copyright &copy; 2001-2002,2004 The Apache Software Foundation. All rights
136Reserved.</p>
137</body>
138</html>
Note: See TracBrowser for help on using the repository browser.