Package org.gradle.api.plugins.quality

# Class PmdPlugin

java.lang.Object
org.gradle.api.plugins.quality.internal.AbstractCodeQualityPlugin<Pmd>
org.gradle.api.plugins.quality.PmdPlugin

All Implemented Interfaces:
  `Plugin<org.gradle.api.internal.project.ProjectInternal>`

public abstract class PmdPlugin extends org.gradle.api.plugins.quality.internal.AbstractCodeQualityPlugin<Pmd>
A plugin for the PMD source code analyzer.

Declares a `pmd` configuration which needs to be configured with the PMD library to be used.

Declares a `pmdAux` configuration to add transitive compileOnly dependencies to the PMD's auxclasspath. This is only needed if PMD complains about NoClassDefFoundError during type resolution.

For each source set that is to be analyzed, a `Pmd` task is created and configured to analyze all Java code.

All PMD tasks (including user-defined ones) are added to the `check` lifecycle task.

See Also:
  - `PmdExtension`
  - `Pmd`
  - PMD plugin reference

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `DEFAULT_PMD_VERSION`

  ### Fields inherited from class org.gradle.api.plugins.quality.internal.AbstractCodeQualityPlugin

  `project`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PmdPlugin()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `(package private) static Set<String>`
  `calculateDefaultDependencyNotation(String versionString)`
  `protected void`
  `configureConfiguration(Configuration configuration)`
  `protected void`
  `configureForSourceSet(SourceSet sourceSet, Pmd task)`
  `protected void`
  `configureTaskDefaults(Pmd task, String baseName)`
  `protected void`
  `createConfigurations()`
  `protected CodeQualityExtension`
  `createExtension()`
  `TargetJdk`
  `getDefaultTargetJdk(JavaVersion javaVersion)`
  Deprecated.
  The `targetJdk` property has no effect for PMD 5.0 and later.
  `protected Class<Pmd>`
  `getTaskType()`
  `protected abstract JavaToolchainService`
  `getToolchainService()`
  `protected String`
  `getToolName()`

  ### Methods inherited from class org.gradle.api.plugins.quality.internal.AbstractCodeQualityPlugin

  `apply, beforeApply, conventionMappingOf, getBasePlugin, getConfigurationName, getJavaPluginExtension, getJvmPluginServices, getReportName, getRootProjectDirectory, getTaskBaseName, withBasePlugin`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### DEFAULT_PMD_VERSION

    public static final String DEFAULT_PMD_VERSION
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### PmdPlugin

    public PmdPlugin()

- ## Method Details

  - ### getToolName

    protected String getToolName()
    Specified by:
      `getToolName` in class `org.gradle.api.plugins.quality.internal.AbstractCodeQualityPlugin<Pmd>`

  - ### getTaskType

    protected Class<Pmd> getTaskType()
    Specified by:
      `getTaskType` in class `org.gradle.api.plugins.quality.internal.AbstractCodeQualityPlugin<Pmd>`

  - ### getToolchainService

    @Inject protected abstract JavaToolchainService getToolchainService()

  - ### createExtension

    protected CodeQualityExtension createExtension()
    Specified by:
      `createExtension` in class `org.gradle.api.plugins.quality.internal.AbstractCodeQualityPlugin<Pmd>`

  - ### getDefaultTargetJdk

    @Deprecated public TargetJdk getDefaultTargetJdk(JavaVersion javaVersion)
    Deprecated.
    The `targetJdk` property has no effect for PMD 5.0 and later. Scheduled to be removed in Gradle 10.
    Returns the default `TargetJdk` for the given Java source compatibility version.

  - ### createConfigurations

    protected void createConfigurations()
    Overrides:
      `createConfigurations` in class `org.gradle.api.plugins.quality.internal.AbstractCodeQualityPlugin<Pmd>`

  - ### configureConfiguration

    protected void configureConfiguration(Configuration configuration)
    Specified by:
      `configureConfiguration` in class `org.gradle.api.plugins.quality.internal.AbstractCodeQualityPlugin<Pmd>`

  - ### configureTaskDefaults

    protected void configureTaskDefaults(Pmd task, String baseName)
    Overrides:
      `configureTaskDefaults` in class `org.gradle.api.plugins.quality.internal.AbstractCodeQualityPlugin<Pmd>`

  - ### calculateDefaultDependencyNotation

    static Set<String> calculateDefaultDependencyNotation(String versionString)

  - ### configureForSourceSet

    protected void configureForSourceSet(SourceSet sourceSet, Pmd task)
    Overrides:
      `configureForSourceSet` in class `org.gradle.api.plugins.quality.internal.AbstractCodeQualityPlugin<Pmd>`