// 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:

=== Example: Using the JDepend plugin

[source.multi-language-sample,groovy]
.build.gradle
----
include::{samplesPath}/codeQuality/build.gradle[tag=use-jdepend-plugin]
----

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:

`jdependMain` — link:{groovyDslPath}/org.gradle.api.plugins.quality.JDepend.html[JDepend]::
_Depends on_: `classes`
+
Runs JDepend against the production Java source files.

`jdependTest` — link:{groovyDslPath}/org.gradle.api.plugins.quality.JDepend.html[JDepend]::
_Depends on_: `testClasses`
+
Runs JDepend against the test Java source files.

`jdepend__SourceSet__` — link:{groovyDslPath}/org.gradle.api.plugins.quality.JDepend.html[JDepend]::
_Depends on_: `__sourceSet__Classes`
+
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.

=== Additional task dependencies

`check`::
All JDepend tasks, including `jdependMain` and `jdependTest`.

[[sec:jdepend_dependency_management]]
== Dependency management

The JDepend plugin adds the following dependency configurations:

=== Dependency configurations

`jdepend`::
The JDepend libraries to use


[[sec:jdepend_configuration]]
== Configuration

See the link:{groovyDslPath}/org.gradle.api.plugins.quality.()JDependExtension.html[JDependExtension] class in the API documentation.
