1 | <html>
|
---|
2 |
|
---|
3 | <head>
|
---|
4 | <meta http-equiv="Content-Language" content="en-us">
|
---|
5 | <title>MMetrics Task</title>
|
---|
6 | <link rel="stylesheet" type="text/css" href="../stylesheets/antmanual.css">
|
---|
7 | </head>
|
---|
8 |
|
---|
9 | <body>
|
---|
10 |
|
---|
11 | <h2>MMetrics</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.
|
---|
17 | An evaluation version is available at <a href="http://www.webgain.com/products/quality_analyzer/">Webgain</a>.
|
---|
18 | (Though you will not be able to use Metrics from the command line if you do not have a registered version).
|
---|
19 | You also need a TRaX compliant processor(such as <a href="http://xml.apache.org/xalan-j/">Xalan 2.x</a>) via JAXP 1.1</p>
|
---|
20 | <h3>Description</h3>
|
---|
21 | <p>
|
---|
22 | Invokes the Metamata Metrics / WebGain Quality Analyzer source code
|
---|
23 | analyzer on a set of Java files.
|
---|
24 | </p>
|
---|
25 | <p>
|
---|
26 | <i>mmetrics</i> will compute the metrics of a set of Java files and write the results to an XML
|
---|
27 | file. As a convenience, a stylesheet is given in <tt>etc</tt> directory, so that an HTML report can be generated from the XML file.
|
---|
28 | </p>
|
---|
29 |
|
---|
30 | <h3>Parameters</h3>
|
---|
31 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
32 | <tr>
|
---|
33 | <td valign="top"><b>Attribute</b></td>
|
---|
34 | <td valign="top"><b>Description</b></td>
|
---|
35 | <td align="center" valign="top"><b>Required</b></td>
|
---|
36 | </tr>
|
---|
37 | <tr>
|
---|
38 | <td valign="top">metamatahome</td>
|
---|
39 | <td valign="top">The home directory containing the Metamata distribution.</td>
|
---|
40 | <td valign="top" align="center">Yes</td>
|
---|
41 | </tr>
|
---|
42 | <tr>
|
---|
43 | <td valign="top">tofile</td>
|
---|
44 | <td valign="top">The XML were the resulting metrics will be written to.</td>
|
---|
45 | <td valign="top" align="center">Yes</td>
|
---|
46 | </tr>
|
---|
47 | <tr>
|
---|
48 | <td valign="top">granularity</td>
|
---|
49 | <td valign="top">Metrics granularity of the source files. Must be either
|
---|
50 | <i>files</i> (compilation-units), <i>types</i> (types and compilation-units) or <i>methods</i>
|
---|
51 | (methods, types and compilation-units).
|
---|
52 | </td>
|
---|
53 | <td valign="top" align="center">Yes</td>
|
---|
54 | </tr>
|
---|
55 | <tr>
|
---|
56 | <td valign="top">maxmemory</td>
|
---|
57 | <td valign="top">Set the maximum memory for the JVM. this is a convenient
|
---|
58 | way to set the -mx or -Xmx argument.</td>
|
---|
59 | <td valign="top" align="center">No</td>
|
---|
60 | </tr>
|
---|
61 | </table>
|
---|
62 | <h3>Nested elements</h3>
|
---|
63 | For specifying the source code to analyze, you can either use a <tt>path</tt> or <tt>fileset</tt> elements (though a single path element is preferred, see note below).
|
---|
64 | <h4>jvmarg</h4>
|
---|
65 | <p>Additional parameters may be passed to the VM via nested <code><jvmarg></code>
|
---|
66 | attributes. <code><jvmarg></code> allows all attributes described in <a href="../using.html#arg">Command
|
---|
67 | line arguments</a>.</p>
|
---|
68 | <h4>classpath</h4>
|
---|
69 | <p>Sets class path (also source path unless one explicitly set). Overrides
|
---|
70 | METAPATH/CLASSPATH environment variables. The <tt>classpath</tt> element represents a <a href="../using.html#path">PATH like
|
---|
71 | structure</a>.</p>
|
---|
72 | <h4>sourcepath</h4>
|
---|
73 | <p>Sets source path. Overrides the SOURCEPATH environment variable. The <tt>sourcepath</tt> element represents a <a href="../using.html#path">PATH like
|
---|
74 | structure</a>.</p>
|
---|
75 |
|
---|
76 | <h4>path</h4>
|
---|
77 | <p>Sets the list of directories to analyze the code for metrics.;It represents a <a href="../using.html#path">PATH structure</a>.</p>
|
---|
78 | <h4>fileset</h4>
|
---|
79 | <p>Sets a set of files to analyze for metrics.source It represents a <a href="../CoreTypes/fileset.html">FILESET structure</a>.</p>
|
---|
80 |
|
---|
81 | <p>
|
---|
82 | <font color="#FF0000">
|
---|
83 | Note: For the sake of readability, it is highly recommended to analyze for a single unique directory instead than
|
---|
84 | using filesets or several directories. Otherwise there will be multiple metrics outputs without any way to know
|
---|
85 | what metrics refers to what source. Chance are also that the XML handler that does some heuristic will be confused
|
---|
86 | by the different outputs.
|
---|
87 | </font>
|
---|
88 | </p>
|
---|
89 |
|
---|
90 | <h3>Example</h3>
|
---|
91 | <pre> <mmetrics tofile="mmetrics.xml"
|
---|
92 | metamatahome="c:/metamata"
|
---|
93 | granularity="methods">
|
---|
94 | <classpath>
|
---|
95 | <pathelement location="c:/metamata/examples/metricsexamples"/>
|
---|
96 | </classpath>
|
---|
97 | <sourcepath>
|
---|
98 | <pathelement location="c:/metamata/examples/metricsexamples"/>
|
---|
99 | </sourcepath>
|
---|
100 | <path>
|
---|
101 | <pathelement location="c:/metamata/examples/metricsexamples"/>
|
---|
102 | </path>
|
---|
103 | </mmetrics></pre>
|
---|
104 | <p>
|
---|
105 | This invokes Metamata Metrics installed in <tt>c:/metamata</tt> on the metrics example.
|
---|
106 | (Note that here, classpath and sourcepath are not normally not needed)
|
---|
107 | </p>
|
---|
108 |
|
---|
109 | <h3>Generating a report</h3>
|
---|
110 | As a convenience, there is an XSL file(mmetrics-frames.xsl) that allows you to generate a full framed HTML report of the metrics.
|
---|
111 | You 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.
|
---|
112 | The stylesheet takes an <i>output.dir</i> parameter (otherwise it will be generated
|
---|
113 | in the current directory), it can be run in Ant as follows:
|
---|
114 | <pre>
|
---|
115 | <style in=java "${metrics.xml}" style="mmetrics-frames.xsl" out="null.tmp">
|
---|
116 | <param name="output.dir" expression="${report.dir}"/>
|
---|
117 | </style>
|
---|
118 | </pre>
|
---|
119 | <hr>
|
---|
120 | <p align="center">Copyright © 2001-2002,2004 The Apache Software Foundation. All rights
|
---|
121 | Reserved.</p>
|
---|
122 | </body>
|
---|
123 | </html>
|
---|