Class AbstractPmdReport

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.maven.reporting.AbstractMavenReport
org.apache.maven.plugins.pmd.AbstractPmdReport
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo, org.apache.maven.reporting.MavenMultiPageReport, org.apache.maven.reporting.MavenReport
Direct Known Subclasses:
CpdReport, PmdReport

public abstract class AbstractPmdReport extends org.apache.maven.reporting.AbstractMavenReport
Base class for the PMD reports.
Version:
$Id$
Author:
Brett Porter
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected boolean
    Deprecated.
    since 3.15.0 Use the goals pmd:aggregate-pmd and pmd:aggregate-cpd instead.
    protected String
    File that lists classes and rules to be excluded from failures.
    protected Map<File,PmdFileInfo>
    The files that are being analyzed.
    protected String
    Set the output format type, in addition to the HTML report.
    protected boolean
    Run PMD on the tests as well.
    protected boolean
    Whether to include the XML files generated by PMD/CPD in the AbstractMavenReport.getReportOutputDirectory().
    protected org.apache.maven.execution.MavenSession
    The current build session instance.
    protected boolean
    Deprecated.
    With 3.22.0 and the upgrade to PMD 7, this parameter has no effect anymore.
    protected boolean
    Skip the PMD/CPD report generation if there are no violations or duplications found.
    protected File
    The output directory for the intermediate XML report.

    Fields inherited from class org.apache.maven.reporting.AbstractMavenReport

    locale, mojoExecution, outputDirectory, outputFormat, outputTimestamp, project, reactorProjects, remoteProjectRepositories, repoSession, siteDirectory, siteRenderer, siteTool

    Fields inherited from interface org.apache.maven.reporting.MavenReport

    CATEGORY_PROJECT_INFORMATION, CATEGORY_PROJECT_REPORTS, ROLE

    Fields inherited from interface org.apache.maven.plugin.Mojo

    ROLE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
     
    protected Collection<org.apache.maven.project.MavenProject>
     
    protected Map<File,PmdFileInfo>
    Convenience method to get files the PMD tool will analyze.
     
    protected org.apache.maven.plugin.MojoExecution
     
    protected org.apache.maven.project.MavenProject
     
    protected List<org.apache.maven.project.MavenProject>
     
    protected boolean
     
    protected boolean
     

    Methods inherited from class org.apache.maven.reporting.AbstractMavenReport

    canGenerateReport, closeReport, constructXrefLocation, execute, executeReport, generate, generate, getCategoryName, getInputEncoding, getLocale, getOutputDirectory, getOutputEncoding, getReportOutputDirectory, getSink, getSinkFactory, getSiteRenderer, getXrefLocation, isExternalReport, setReportOutputDirectory

    Methods inherited from class org.apache.maven.plugin.AbstractMojo

    getLog, getPluginContext, setLog, setPluginContext

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface org.apache.maven.reporting.MavenReport

    getDescription, getName, getOutputName, getOutputPath
  • Field Details

    • targetDirectory

      @Parameter(property="project.build.directory", required=true) protected File targetDirectory
      The output directory for the intermediate XML report.
    • format

      @Parameter(property="format", defaultValue="xml") protected String format
      Set the output format type, in addition to the HTML report. Must be one of: "none", "csv", "xml", "txt" or the full class name of the PMD renderer to use. See the net.sourceforge.pmd.renderers package javadoc for available renderers. XML is produced in any case, since this format is needed for the check goals (pmd:check, pmd:aggregator-check, pmd:cpd-check, pmd:aggregator-cpd-check).
    • includeTests

      @Parameter(defaultValue="false") protected boolean includeTests
      Run PMD on the tests as well.
      Since:
      2.2
    • aggregate

      @Parameter(property="aggregate", defaultValue="false") @Deprecated protected boolean aggregate
      Deprecated.
      since 3.15.0 Use the goals pmd:aggregate-pmd and pmd:aggregate-cpd instead. See FAQ: Why do I get sometimes false positive and/or false negative violations? for an explanation.
      Whether to build an aggregated report at the root, or build individual reports.
      Since:
      2.2
    • includeXmlInReports

      @Parameter(defaultValue="false") protected boolean includeXmlInReports
      Whether to include the XML files generated by PMD/CPD in the AbstractMavenReport.getReportOutputDirectory().
      Since:
      3.0
    • skipEmptyReport

      @Parameter(defaultValue="false") protected boolean skipEmptyReport
      Skip the PMD/CPD report generation if there are no violations or duplications found. Defaults to false.

      Note: the default value was changed from true to false with version 3.13.0.

      Since:
      3.1
    • excludeFromFailureFile

      @Parameter(property="pmd.excludeFromFailureFile", defaultValue="") protected String excludeFromFailureFile
      File that lists classes and rules to be excluded from failures. For PMD, this is a properties file. For CPD, this is a text file that contains comma-separated lists of classes that are allowed to duplicate.
      Since:
      3.7
    • showPmdLog

      @Parameter(defaultValue="true", property="pmd.showPmdLog") @Deprecated protected boolean showPmdLog
      Deprecated.
      With 3.22.0 and the upgrade to PMD 7, this parameter has no effect anymore. The PMD log is now always redirected into the maven log and this can't be disabled by this parameter anymore. In order to disable the logging, see Maven Logging. You'd need to start maven with MAVEN_OPTS=-Dorg.slf4j.simpleLogger.log.net.sourceforge.pmd=off mvn <goals>.
      Redirect PMD log into maven log out. When enabled, the PMD log output is redirected to maven, so that it is visible in the console together with all the other log output. Also, if maven is started with the debug flag (-X or --debug), the PMD logger is also configured for debug.
      Since:
      3.9.0
    • session

      @Parameter(defaultValue="${session}", required=true, readonly=true) protected org.apache.maven.execution.MavenSession session
      The current build session instance. This is used for toolchain manager API calls and for dependency resolver API calls.
    • filesToProcess

      protected Map<File,PmdFileInfo> filesToProcess
      The files that are being analyzed.
  • Constructor Details

    • AbstractPmdReport

      public AbstractPmdReport()
  • Method Details

    • getProject

      protected org.apache.maven.project.MavenProject getProject()
      Overrides:
      getProject in class org.apache.maven.reporting.AbstractMavenReport
    • getReactorProjects

      protected List<org.apache.maven.project.MavenProject> getReactorProjects()
    • getMojoExecution

      protected org.apache.maven.plugin.MojoExecution getMojoExecution()
    • getFilesToProcess

      protected Map<File,PmdFileInfo> getFilesToProcess() throws IOException
      Convenience method to get files the PMD tool will analyze.
      Returns:
      the files the PMD tool will analyze
      Throws:
      IOException - if an I/O error occurs during construction of the canonical paths of the files
    • isXml

      protected boolean isXml()
    • canGenerateReportInternal

      protected boolean canGenerateReportInternal() throws org.apache.maven.reporting.MavenReportException
      Throws:
      org.apache.maven.reporting.MavenReportException
    • getJdkToolchain

      public Map<String,String> getJdkToolchain()
    • isAggregator

      protected boolean isAggregator()
    • getAggregatedProjects

      protected Collection<org.apache.maven.project.MavenProject> getAggregatedProjects()