You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

jdepend.html 6.6 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <!--
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. -->
  15. <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
  16. <html>
  17. <head>
  18. <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
  19. <title>JDepend Task</title>
  20. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  21. <meta http-equiv="Content-Language" content="en-us">
  22. </head>
  23. <body>
  24. <h2><a NAME="JDepend"></a>JDepend</h2>
  25. <h3>Description</h3>
  26. <P>Invokes the <a href="http://www.clarkware.com/software/JDepend.html">JDepend</a> parser.</P>
  27. <P>This parser &quot;traverses a set of Java source file directories and generates design quality metrics for each Java package&quot;.
  28. It allows to &quot;automatically measure the quality of a design in terms of its extensibility, reusability, and maintainability to
  29. effectively manage and control package dependencies.&quot;</P>
  30. <p>Source file directories are defined by nested
  31. <code>&lt;sourcespath&gt;</code>; Class file directories are defined
  32. by nested <code>&lt;classesespath&gt;</code>, see <a
  33. href="#nested">nested elements</a>.</p>
  34. <p>Optionally, you can also set the <code>outputfile</code> name where the output is stored. By default the task writes its report to the standard output.</P>
  35. <p> The task requires at least the JDepend 1.2 version. </p>
  36. <h3>Parameters</h3>
  37. <table BORDER=1 CELLSPACING=0 CELLPADDING=2 >
  38. <tr>
  39. <td VALIGN=TOP><b>Attribute</b></td>
  40. <td VALIGN=TOP><b>Description</b></td>
  41. <td ALIGN=CENTER VALIGN=TOP><b>Required</b></td>
  42. </tr>
  43. <tr>
  44. <td VALIGN=TOP>outputfile</td>
  45. <td VALIGN=TOP>The output file name. If not set, the output is printed on the standard output.</td>
  46. <td ALIGN=CENTER VALIGN=TOP>No</td>
  47. </tr>
  48. <tr>
  49. <td VALIGN=TOP>format</td>
  50. <td VALIGN=TOP>The format to write the output in. The default is "text", the alternative is "xml"</td>
  51. <td ALIGN=CENTER VALIGN=TOP>No</td>
  52. </tr>
  53. <tr>
  54. <td VALIGN=TOP>fork</td>
  55. <td VALIGN=TOP>Run the tests in a separate VM.</td>
  56. <td ALIGN=CENTER VALIGN=TOP>No, default is "off"</td>
  57. </tr>
  58. <tr>
  59. <td VALIGN=TOP>haltonerror</td>
  60. <td VALIGN=TOP>Stop the build process if an error occurs during the jdepend analysis.</td>
  61. <td ALIGN=CENTER VALIGN=TOP>No, default is "off"</td>
  62. </tr>
  63. <tr>
  64. <td VALIGN=TOP>timeout</td>
  65. <td VALIGN=TOP>Cancel the operation if it doesn't finish in the given time (measured in milliseconds). (Ignored if fork is disabled.)</td>
  66. <td ALIGN=CENTER VALIGN=TOP>No</td>
  67. </tr>
  68. <tr>
  69. <td VALIGN=TOP>jvm</td>
  70. <td VALIGN=TOP>The command used to invoke the Java Virtual Machine, default is 'java'. The command is resolved by java.lang.Runtime.exec(). (Ignored if fork is disabled.)</td>
  71. <td ALIGN=CENTER VALIGN=TOP>No, default "java"</td>
  72. </tr>
  73. <tr>
  74. <td VALIGN=TOP>dir</td>
  75. <td VALIGN=TOP>The directory to invoke the VM in. (Ignored if fork is disabled)</td>
  76. <td ALIGN=CENTER VALIGN=TOP>No</td>
  77. </tr>
  78. <tr>
  79. <td VALIGN=TOP>includeruntime</td>
  80. <td VALIGN=TOP>Implicitly add the classes required to run jdepend
  81. in forked mode. (Ignored if fork is disabled). Since ant 1.6.</td>
  82. <td ALIGN=CENTER VALIGN=TOP>No, default is "no".</td>
  83. </tr>
  84. <tr>
  85. <td VALIGN=TOP>classpathref</td>
  86. <td VALIGN=TOP>the classpath to use, given as reference to a PATH defined elsewhere.</td>
  87. <td ALIGN=CENTER VALIGN=TOP>No</td>
  88. </tr>
  89. </table>
  90. <h3><a name="nested">Nested Elements</a></h3>
  91. <p><code>jdepend</code> supports four nested elements:
  92. <code>&lt;classpath&gt;, &lt;classespath&gt; </code> and
  93. <code>&lt;sourcespath&gt;</code>, that represent <a
  94. href="../using.html#path">PATH like structures</a>, and
  95. <code>&lt;exclude&gt;</code>.</p>
  96. <p><code>&lt;sourcespath&gt;</code> is used to define the paths of the
  97. source code to analyze, but it is deprecated. With version 2.5 of
  98. JDepend, only class files are analyzed. The nested element
  99. <code>&lt;classespath&gt;</code> replaces <code>&lt;sourcespath&gt;</code> and is used to define
  100. the paths of compiled class code to analyze; the <code>&lt;sourcespath&gt;</code>
  101. variable is still available in case you are using an earlier version
  102. of JDepend. The <code>&lt;exclude&gt;</code> element can be used to set packages
  103. to ignore (requires JDepend 2.5 or above).</p>
  104. <h3>Examples</h3>
  105. <blockquote>
  106. <pre>
  107. &lt;jdepend classpathref="base.path"&gt;
  108. &nbsp;&nbsp;&nbsp; &lt;classespath&gt;
  109. &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;pathelement location="build"/&gt;
  110. &nbsp;&nbsp;&nbsp; &lt;/classespath&gt;
  111. &lt;/jdepend&gt;
  112. </pre>
  113. </blockquote>
  114. <p>This invokes JDepend on the <code>build</code> directory, writing
  115. the output on the standard output. The classpath is defined using a
  116. classpath reference.</p>
  117. <blockquote>
  118. <pre>
  119. &lt;jdepend outputfile="docs/jdepend.xml" fork="yes" format="xml"&gt;
  120. &nbsp;&nbsp;&nbsp; &lt;sourcespath&gt;
  121. &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;pathelement location="src"/&gt;
  122. &nbsp;&nbsp;&nbsp; &lt;/sourcespath&gt;
  123. &nbsp;&nbsp;&nbsp; &lt;classpath&gt;
  124. &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;pathelement location="classes"/&gt;
  125. &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;pathelement location="lib/jdepend.jar"/&gt;
  126. &nbsp;&nbsp;&nbsp; &lt;/classpath&gt;
  127. &lt;/jdepend&gt;
  128. </pre>
  129. </blockquote>
  130. <p>This invokes JDepend in a separate VM on the <code>src</code> and
  131. <code>testsrc</code> directories, writing the output to the
  132. <code>&lt;docs/jdepend.xml&gt;</code> file in xml format. The
  133. classpath is defined using nested elements. </p>
  134. <blockquote>
  135. <pre>
  136. &lt;jdepend classpathref="base.path"&gt;
  137. &nbsp;&nbsp;&nbsp; &lt;exclude name="java.*&gt;
  138. &nbsp;&nbsp;&nbsp; &lt;exclude name="javax.*&gt;
  139. &nbsp;&nbsp;&nbsp; &lt;classespath&gt;
  140. &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;pathelement location="build"/&gt;
  141. &nbsp;&nbsp;&nbsp; &lt;/classespath&gt;
  142. &lt;/jdepend&gt;
  143. </pre>
  144. </blockquote>
  145. <p>This invokes JDepend with the build directory as the base for class
  146. files to analyze, and will ignore all classes in the java.* and
  147. javax.* packages.</p>
  148. </body>
  149. </html>