第三十二章. JDepend 插件

Chapter 32. The JDepend Plugin

JDepend 插件使用 JDepend对项目的源文件执行质量检查,并从检查结果中生成报告。
The JDepend plugin performs quality checks on your project's source files using JDepend and generates reports from these checks.

32.1. 用法

32.1. Usage

要使用 JDepend 插件,请在构建脚本中包含以下语句:
To use the JDepend plugin, include in your build script:

示例 32.1. 使用 JDepend 插件
Example 32.1. Using the JDepend plugin

build.gradle

apply plugin: 'jdepend'

该插件向你的项目添加了大量的执行质量检查的任务。你可以通过运行 gradle check 执行检查。
The plugin adds a number of tasks to the project that perform the quality checks. You can execute the checks by running gradle check .

32.2. 任务

32.2. Tasks

JDepend 插件向project 中添加了以下任务:
The JDepend plugin adds the following tasks to the project:

表 32.1. JDepend 插件 - 任务
Table 32.1. JDepend plugin - tasks

任务名称
Task name
依赖于
Depends on
类型
Type
描述
Description
jdependMain classes JDepend 针对生产Java 源文件运行 JDepend。
Runs JDepend against the production Java source files.
jdependTest testClasses JDepend 针对测试Java 源文件运行 JDepend。
Runs JDepend against the test Java source files.
jdependSourceSet sourceSet Classes JDepend 针对source set 的 Java 源文件运行 JDepend。
Runs JDepend against the given source set's Java source files.

JDepend 插件向 Java 插件所加入的任务添加了以下的依赖。
The JDepend plugin adds the following dependencies to tasks defined by the Java plugin.

表 32.2. JDepend 插件 - 附加的任务依赖
Table 32.2. JDepend plugin - additional task dependencies

任务名称
Task name
依赖于
Depends on
check 所有 JDepend 任务,包括 jdependMainjdependTest
All JDepend tasks, including jdependMain and jdependTest .

32.3. 依赖管理

32.3. Dependency management

JDepend 插件添加了下列的依赖配置:
The JDepend plugin adds the following dependency configurations:

表32.3. JDepend 插件 ​​- 依赖配置
Table 32.3. JDepend plugin - dependency configurations

名称
Name
意义
Meaning
jdepend 使用的 JDepend 库
The JDepend libraries to use

32.4. 配置

32.4. Configuration

请参阅 JDependExtension
See JDependExtension .