codepro.metrics
This function is deprecated and has
been replaced by the
instantiations.metrics
Ant Task in
CodePro AnalytiX Server
.
Description
An Ant task that computes metrics for Java source files. This is identical
to the Compute Metrics command
available via the Application Developer and Eclipse IDE user interface.
Attributes
The following is a list of the attributes supported for the
codepro.metrics task.
Attribute |
Description |
Required |
classpath |
The classpath used for resources that exist outside of the projects
contained by the current Eclipse workspace. The classpath attribute is a
path-like
structure and can also be set via a nested
<classpath> element similar to the classpath attribute
in the javac
Ant task.
Note: The classpath attribute relies on functionality that exists
in Eclipse 2.1, but not in Eclipse 2.0 / Application Developer 5.0.
If you want to use this, you will have to download and install Eclipse 2.1.
See the notes on the Eclipse headless Ant
environment.
|
No |
metricSetName |
The name of the
metric
set that will be used to generate metric results. If the
metricSetFile attribute is specified (see below) then the
named metric set in the specified file is used, otherwise the named metric
set in the workspace is used. If no metric set name is specified then
either the first metric set in the file or the default metric set in the
workspace is used depending upon whether or not the
metricSetFile attribute is specified.
|
No |
metricSetFile |
The absolute or relative path to the file that contains the
metric
set to be used. If the metricSetName attribute is
specified (see above) then the metric set located in the specified file
with the specified name is used, otherwise the first metric set in the
file is used. If the metricSetFile attribute is not
specified, then a metric set from the workspace is used. Either the
export preferences command or the
export button on
the metrics preference page can be used to generate a file containing
metric sets.
|
No |
Deprecated Attributes
The following attributes are deprecated in favor of more flexible
mechanisms. While they are still currently supported, they should be
replaced by the newer mechanisms, as described for each attribute.
Attribute |
Description |
Required |
resultFile |
Deprecated: use the nested report element instead
The absolute or relative path to the file to which metric results will be
written. If not specified, then no metric results will be written to any
file. Regardless of whether or not the resultFile attribute
is specified, if the ant task is being executed inside the IDE user
interface, then the metric results will appear in the
Metrics view.
|
No |
resultFormat |
Deprecated: use the nested report element instead
The format in which the metric results will be written. If not specified,
then the results will be written in a simple text format. Currently
supported formats include:
- text
- commaSeparatedData
- tabSeparatedData
- html
- xml
|
No |
includeSubScopes |
Deprecated: use the nested report element instead
A boolean value indicating whether or not sub-scopes should be included
in the results.
|
No |
includeTypeLevelMetrics |
Deprecated: use the nested report element instead
A boolean value indicating whether or not type-level metrics should be
included in the results.
|
No |
includeDetails |
Deprecated: use the nested report element instead
A boolean value indicating whether or not details should be included in
the results.
|
No |
Nested Elements
The following elements can be nested within the codepro.metrics
task.
<fileSet>
The standard ant
FileSet
structure is used to specify which files are to be included. Only *.java
files in the file set will have metrics computed for them... all others
will be ignored by the
codepro.metrics ant task. If you specify *.java files outside
of the projects contained by the current Eclipse worspace, then you must
specify a classpath or those external files will be ignored by the
codepro.metrics ant task.
<classpath>
The classpath used for resources that exist outside of the projects
contained by the current Eclipse workspace. The classpath element is
similar to the classpath attribute in the
javac
Ant task.
<report>
The report
element is used to generate a report based on the results of the metric
computation.
Examples
The following Ant task will use the metric set named
"MyMetricSet" contained in the file named
"metrics.pref" to compute metrics for the Java files in the
directory structure rooted at "../MyJavaProject/src". After the
metrics computation is complete, an XML report will be generated to the
file named "metrics_result.xml". In addition, the report will
be e-mailed to the project manager.
<codepro.metrics
metricSetName="MyMetricSet"
metricSetFile="metrics.pref">
<fileSet dir="../MyJavaProject/src"/>
<report
file="metrics_result.xml"
format="xml"
<mail
username="user"
password="password"
from="testManager@company.com"
tolist="projectManager@company.com"/>
</report>
</codepro.metrics>
Eclipse 3.0 Usage
Under Eclipse 2.1 and earlier, Ant tasks are run in the same JRE as the
IDE and can make use of Eclipse libraries. Under Eclipse 3.0, Ant tasks
are normally run in a separate JRE and don't have access to Eclipse
libraries. The codepro.metrics Ant task requires access to various
Eclipse libraries, and therefore cannot run in a separate JRE. In order to
use the codepro.metrics Ant task within Eclipse, you need to select
the Run in the same JRE as the workspace option from the JRE
page of the Run Ant dialog.
|