// Copyright 2017 the original author or authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

[[jdepend_plugin]]
== The JDepend Plugin

The JDepend plugin performs quality checks on your project's source files using http://clarkware.com/software/JDepend.html[JDepend] and generates reports from these checks.


[[sec:jdepend_usage]]
=== Usage

To use the JDepend plugin, include the following in your build script:

++++
<sample id="useJDependPlugin" dir="codeQuality" title="Using the JDepend plugin">
            <sourcefile file="build.gradle" snippet="use-jdepend-plugin"/>
        </sample>
++++

The plugin adds a number of tasks to the project that perform the quality checks. You can execute the checks by running `gradle check`.

Note that JDepend will run with the same Java version used to run Gradle.

[[sec:jdepend_tasks]]
=== Tasks

The JDepend plugin adds the following tasks to the project:

.JDepend plugin - tasks
[cols="a,a,a,a", options="header"]
|===
| Task name
| Depends on
| Type
| Description

| `jdependMain`
| `classes`
| api:org.gradle.api.plugins.quality.JDepend[]
| Runs JDepend against the production Java source files.

| `jdependTest`
| `testClasses`
| api:org.gradle.api.plugins.quality.JDepend[]
| Runs JDepend against the test Java source files.

| `jdepend__SourceSet__`
| `__sourceSet__Classes`
| api:org.gradle.api.plugins.quality.JDepend[]
| Runs JDepend against the given source set's Java source files.
|===

The JDepend plugin adds the following dependencies to tasks defined by the Java plugin.

.JDepend plugin - additional task dependencies
[cols="a,a", options="header"]
|===
| Task name
| Depends on
| `check`
| All JDepend tasks, including `jdependMain` and `jdependTest`.
|===


[[sec:jdepend_dependency_management]]
=== Dependency management

The JDepend plugin adds the following dependency configurations:

.JDepend plugin - dependency configurations
[cols="a,a", options="header"]
|===
| Name
| Meaning

| `jdepend`
| The JDepend libraries to use
|===


[[sec:jdepend_configuration]]
=== Configuration

See the api:org.gradle.api.plugins.quality.JDependExtension[] class in the API documentation.