Class Pmd

    • Constructor Detail

      • Pmd

        public Pmd()
    • Method Detail

      • getAntBuilder

        @Inject
        public org.gradle.api.internal.project.IsolatedAntBuilder getAntBuilder()
      • run

        public void run()
      • stdOutIsAttachedToTerminal

        public boolean stdOutIsAttachedToTerminal()
      • reports

        public PmdReports reports​(Action<? super PmdReports> configureAction)
        Configures the reports to be generated by this task.
        Specified by:
        reports in interface Reporting<PmdReports>
        Parameters:
        configureAction - The configuration
        Returns:
        The report container
        Since:
        3.0
      • validate

        public static void validate​(int value)
        Validates the value is a valid PMD RulePriority (1-5)
        Parameters:
        value - rule priority threshold
      • getSource

        @PathSensitive(RELATIVE)
        public FileTree getSource()
        Returns the source for this task, after the include and exclude patterns have been applied. Ignores source files which do not exist.
        Overrides:
        getSource in class SourceTask
        Returns:
        The source.
      • getPmdClasspath

        @Classpath
        public FileCollection getPmdClasspath()
        The class path containing the PMD library to be used.
      • setPmdClasspath

        public void setPmdClasspath​(FileCollection pmdClasspath)
        The class path containing the PMD library to be used.
      • getRuleSets

        @Input
        public List<String> getRuleSets()
        The built-in rule sets to be used. See the official list of built-in rule sets. Example: ruleSets = ["basic", "braces"]
      • setRuleSets

        public void setRuleSets​(List<String> ruleSets)
        The built-in rule sets to be used. See the official list of built-in rule sets. Example: ruleSets = ["basic", "braces"]
      • getTargetJdk

        @Input
        public TargetJdk getTargetJdk()
        The target JDK to use with PMD.
      • setTargetJdk

        public void setTargetJdk​(TargetJdk targetJdk)
        The target JDK to use with PMD.
      • getRuleSetConfig

        @Incubating
        @Optional
        public TextResource getRuleSetConfig()
        The custom rule set to be used (if any). Replaces ruleSetFiles, except that it does not currently support multiple rule sets. See the official documentation for how to author a rule set. Example: ruleSetConfig = resources.text.fromFile(resources.file("config/pmd/myRuleSets.xml"))
        Since:
        2.2
      • setRuleSetConfig

        @Incubating
        public void setRuleSetConfig​(TextResource ruleSetConfig)
        The custom rule set to be used (if any). Replaces ruleSetFiles, except that it does not currently support multiple rule sets. See the official documentation for how to author a rule set. Example: ruleSetConfig = resources.text.fromFile(resources.file("config/pmd/myRuleSets.xml"))
        Since:
        2.2
      • setRuleSetFiles

        public void setRuleSetFiles​(FileCollection ruleSetFiles)
        The custom rule set files to be used. See the official documentation for how to author a rule set file. Example: ruleSetFiles = files("config/pmd/myRuleSets.xml")
      • getIgnoreFailures

        public boolean getIgnoreFailures()
        Whether or not to allow the build to continue if there are warnings. Example: ignoreFailures = true
        Specified by:
        getIgnoreFailures in interface VerificationTask
        Returns:
        false, when the build should break on failure, true when the failures should be ignored.
      • setIgnoreFailures

        public void setIgnoreFailures​(boolean ignoreFailures)
        Whether or not to allow the build to continue if there are warnings. Example: ignoreFailures = true
        Specified by:
        setIgnoreFailures in interface VerificationTask
        Parameters:
        ignoreFailures - false to break the build on failure, true to ignore the failures. The default is false.
      • setRulePriority

        @Incubating
        public void setRulePriority​(int intValue)
        Sets the rule priority threshold.
        Since:
        2.8
      • isConsoleOutput

        @Input
        @Incubating
        public boolean isConsoleOutput()
        Whether or not to write PMD results to System.out.
        Since:
        2.1
      • setConsoleOutput

        @Incubating
        public void setConsoleOutput​(boolean consoleOutput)
        Whether or not to write PMD results to System.out.
        Since:
        2.1
      • getClasspath

        @Classpath
        @Optional
        @Incubating
        public FileCollection getClasspath()
        Compile class path for the classes to be analyzed. The classes on this class path are used during analysis but aren't analyzed themselves. This is only well supported for PMD 5.2.1 or better.
        Since:
        2.8
      • setClasspath

        @Incubating
        public void setClasspath​(FileCollection classpath)
        Compile class path for the classes to be analyzed. The classes on this class path are used during analysis but aren't analyzed themselves. This is only well supported for PMD 5.2.1 or better.
        Since:
        2.8