@Incubating
public class CpdPlugin
extends java.lang.Object
implements org.gradle.api.Plugin<org.gradle.api.Project>
Creates and registers a cpd extension with the default task options for every task of type Cpd.
Declares a cpd configuration which needs to be configured with the
PMD library containing the
CPD library to be used.
A Cpd task named cpd is created and configured with default options. It can be further configured to analyze the source
code you want, e.g. source = project.files('src').
The created Cpd task is added to the check lifecycle task of LifecycleBasePlugin if it is also applied, e.g.
using JavaPlugin.
Sample:
apply plugin: 'cpd'
repositories{
mavenCentral()
}
cpd {
minimumTokenCount = 25
// As PMD was split with v5.2.0 and CPD has moved to 'pmd-core', 'toolVersion' is just available for 5.2.0 and higher
toolVersion = 5.2.1
}
tasks.cpd {
allprojects.findAll{ p -> p.hasProperty('sourceSets') }.each{ p ->
p.sourceSets.all{ sourceSet -> source sourceSet.allJava }
}
}
CpdExtension,
Cpd| Constructor and Description |
|---|
CpdPlugin() |
| Modifier and Type | Method and Description |
|---|---|
void |
apply(org.gradle.api.Project project) |