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 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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. <html>
  16. <head>
  17. <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
  18. <title>JDepend Task</title>
  19. <meta http-equiv="Content-Language" content="en-us">
  20. </head>
  21. <body>
  22. <h2 id="jdepend">JDepend</h2>
  23. <h3>Description</h3>
  24. <p>Invokes the <a href="http://www.clarkware.com/software/JDepend.html">JDepend</a> parser.</p>
  25. <p>This parser &quot;traverses a set of Java source file directories and generates design quality metrics for each Java package&quot;.
  26. It allows to &quot;automatically measure the quality of a design in terms of its extensibility, reusability, and maintainability to
  27. effectively manage and control package dependencies.&quot;</p>
  28. <p>Source file directories are defined by nested
  29. <code>&lt;sourcespath&gt;</code>; Class file directories are defined
  30. by nested <code>&lt;classespath&gt;</code>, see <a
  31. href="#nested">nested elements</a>.</p>
  32. <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>
  33. <p>The task requires at least the JDepend 1.2 version.</p>
  34. <h3>Parameters</h3>
  35. <table>
  36. <tr>
  37. <td valign="top"><b>Attribute</b></td>
  38. <td valign="top"><b>Description</b></td>
  39. <td align="center" valign="top"><b>Required</b></td>
  40. </tr>
  41. <tr>
  42. <td valign="top">outputfile</td>
  43. <td valign="top">The output file name. If not set, the output is printed on the standard output.</td>
  44. <td align="center" valign="top">No</td>
  45. </tr>
  46. <tr>
  47. <td valign="top">format</td>
  48. <td valign="top">The format to write the output in. The default is "text", the alternative is "xml"</td>
  49. <td align="center" valign="top">No</td>
  50. </tr>
  51. <tr>
  52. <td valign="top">fork</td>
  53. <td valign="top">Run the tests in a separate VM.</td>
  54. <td align="center" valign="top">No, default is "off"</td>
  55. </tr>
  56. <tr>
  57. <td valign="top">haltonerror</td>
  58. <td valign="top">Stop the build process if an error occurs during the jdepend analysis.</td>
  59. <td align="center" valign="top">No, default is "off"</td>
  60. </tr>
  61. <tr>
  62. <td valign="top">timeout</td>
  63. <td valign="top">Cancel the operation if it doesn't finish in the given time (measured in milliseconds). (Ignored if fork is disabled.)</td>
  64. <td align="center" valign="top">No</td>
  65. </tr>
  66. <tr>
  67. <td valign="top">jvm</td>
  68. <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>
  69. <td align="center" valign="top">No, default "java"</td>
  70. </tr>
  71. <tr>
  72. <td valign="top">dir</td>
  73. <td valign="top">The directory to invoke the VM in. (Ignored if fork is disabled)</td>
  74. <td align="center" valign="top">No</td>
  75. </tr>
  76. <tr>
  77. <td valign="top">includeruntime</td>
  78. <td valign="top">Implicitly add the classes required to run jdepend
  79. in forked mode. (Ignored if fork is disabled). <em>Since Apache Ant 1.6</em>.</td>
  80. <td align="center" valign="top">No, default is "no".</td>
  81. </tr>
  82. <tr>
  83. <td valign="top">classpathref</td>
  84. <td valign="top">the classpath to use, given as reference to a PATH defined elsewhere.</td>
  85. <td align="center" valign="top">No</td>
  86. </tr>
  87. </table>
  88. <h3 id="nested">Nested Elements</h3>
  89. <p><code>jdepend</code> supports four nested elements:
  90. <code>&lt;classpath&gt;, &lt;classespath&gt;</code> and
  91. <code>&lt;sourcespath&gt;</code>, that represent <a
  92. href="../using.html#path">PATH like structures</a>, and
  93. <code>&lt;exclude&gt;</code>.</p>
  94. <p><code>&lt;sourcespath&gt;</code> is used to define the paths of the
  95. source code to analyze, but it is deprecated. With version 2.5 of
  96. JDepend, only class files are analyzed. The nested element
  97. <code>&lt;classespath&gt;</code> replaces <code>&lt;sourcespath&gt;</code> and is used to define
  98. the paths of compiled class code to analyze; the <code>&lt;sourcespath&gt;</code>
  99. variable is still available in case you are using an earlier version
  100. of JDepend. The <code>&lt;exclude&gt;</code> element can be used to set packages
  101. to ignore (requires JDepend 2.5 or above).</p>
  102. <h3>Examples</h3>
  103. <blockquote>
  104. <pre>
  105. &lt;jdepend classpathref="base.path"&gt;
  106. &nbsp;&nbsp;&nbsp; &lt;classespath&gt;
  107. &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;pathelement location="build"/&gt;
  108. &nbsp;&nbsp;&nbsp; &lt;/classespath&gt;
  109. &lt;/jdepend&gt;
  110. </pre>
  111. </blockquote>
  112. <p>This invokes JDepend on the <code>build</code> directory, writing
  113. the output on the standard output. The classpath is defined using a
  114. classpath reference.</p>
  115. <blockquote>
  116. <pre>
  117. &lt;jdepend outputfile="docs/jdepend.xml" fork="yes" format="xml"&gt;
  118. &nbsp;&nbsp;&nbsp; &lt;sourcespath&gt;
  119. &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;pathelement location="src"/&gt;
  120. &nbsp;&nbsp;&nbsp; &lt;/sourcespath&gt;
  121. &nbsp;&nbsp;&nbsp; &lt;classpath&gt;
  122. &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;pathelement location="classes"/&gt;
  123. &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;pathelement location="lib/jdepend.jar"/&gt;
  124. &nbsp;&nbsp;&nbsp; &lt;/classpath&gt;
  125. &lt;/jdepend&gt;
  126. </pre>
  127. </blockquote>
  128. <p>This invokes JDepend in a separate VM on the <code>src</code> and
  129. <code>testsrc</code> directories, writing the output to the
  130. <code>&lt;docs/jdepend.xml&gt;</code> file in xml format. The
  131. classpath is defined using nested elements.</p>
  132. <blockquote>
  133. <pre>
  134. &lt;jdepend classpathref="base.path"&gt;
  135. &nbsp;&nbsp;&nbsp; &lt;exclude name="java.*&gt;
  136. &nbsp;&nbsp;&nbsp; &lt;exclude name="javax.*&gt;
  137. &nbsp;&nbsp;&nbsp; &lt;classespath&gt;
  138. &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;pathelement location="build"/&gt;
  139. &nbsp;&nbsp;&nbsp; &lt;/classespath&gt;
  140. &lt;/jdepend&gt;
  141. </pre>
  142. </blockquote>
  143. <p>This invokes JDepend with the build directory as the base for class
  144. files to analyze, and will ignore all classes in the java.* and
  145. javax.* packages.</p>
  146. </body>
  147. </html>