Package org.apache.maven.plugins.pmd
Class AbstractPmdReport
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.apache.maven.reporting.AbstractMavenReport
-
- org.apache.maven.plugins.pmd.AbstractPmdReport
-
- All Implemented Interfaces:
ContextEnabled
,Mojo
,MavenMultiPageReport
,MavenReport
public abstract class AbstractPmdReport extends AbstractMavenReport
Base class for the PMD reports.- Version:
- $Id$
- Author:
- Brett Porter
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
aggregate
Whether to build an aggregated report at the root, or build individual reports.protected java.lang.String
excludeFromFailureFile
File that lists classes and rules to be excluded from failures.protected java.util.Map<java.io.File,PmdFileInfo>
filesToProcess
The files that are being analyzed.protected java.lang.String
format
Set the output format type, in addition to the HTML report.protected boolean
includeTests
Run PMD on the tests.protected boolean
includeXmlInSite
Whether to include the xml files generated by PMD/CPD in the site.protected java.io.File
outputDirectory
The output directory for the final HTML report.protected MavenProject
project
The project to analyse.protected java.util.List<MavenProject>
reactorProjects
The projects in the reactor for aggregation report.protected MavenSession
session
The current build session instance.protected boolean
showPmdLog
Redirect PMD log into maven log out.protected boolean
skipEmptyReport
Skip the PMD/CPD report generation if there are no violations or duplications found.protected java.io.File
targetDirectory
The output directory for the intermediate XML report.-
Fields inherited from interface org.apache.maven.reporting.MavenReport
CATEGORY_PROJECT_INFORMATION, CATEGORY_PROJECT_REPORTS, ROLE
-
-
Constructor Summary
Constructors Constructor Description AbstractPmdReport()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canGenerateReport()
protected java.lang.String
constructXRefLocation(boolean test)
protected java.lang.String
determineCurrentRootLogLevel()
protected java.util.Map<java.io.File,PmdFileInfo>
getFilesToProcess()
Convenience method to get the list of files where the PMD tool will be executedprotected java.lang.String
getOutputDirectory()
protected java.lang.String
getOutputEncoding()
Gets the effective reporting output files encoding.protected MavenProject
getProject()
protected Renderer
getSiteRenderer()
protected java.lang.String
getSourceEncoding()
protected Toolchain
getToolchain()
protected boolean
isXml()
-
Methods inherited from class org.apache.maven.reporting.AbstractMavenReport
closeReport, execute, executeReport, generate, generate, generate, getCategoryName, getInputEncoding, getReportOutputDirectory, getSink, getSinkFactory, 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
-
-
-
-
Field Detail
-
targetDirectory
@Parameter(property="project.build.directory", required=true) protected java.io.File targetDirectory
The output directory for the intermediate XML report.
-
outputDirectory
@Parameter(property="project.reporting.outputDirectory", required=true) protected java.io.File outputDirectory
The output directory for the final HTML report. Note that this parameter is only evaluated if the goal is run directly from the command line or during the default lifecycle. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.
-
format
@Parameter(property="format", defaultValue="xml") protected java.lang.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:cpd-check).
-
includeTests
@Parameter(defaultValue="false") protected boolean includeTests
Run PMD on the tests.- Since:
- 2.2
-
aggregate
@Parameter(property="aggregate", defaultValue="false") protected boolean aggregate
Whether to build an aggregated report at the root, or build individual reports.- Since:
- 2.2
-
includeXmlInSite
@Parameter(defaultValue="false") protected boolean includeXmlInSite
Whether to include the xml files generated by PMD/CPD in the site.- 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 tofalse
.Note: the default value was changed from
true
tofalse
with version 3.13.0.- Since:
- 3.1
-
excludeFromFailureFile
@Parameter(property="pmd.excludeFromFailureFile", defaultValue="") protected java.lang.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") protected boolean showPmdLog
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
-
project
@Parameter(defaultValue="${project}", readonly=true, required=true) protected MavenProject project
The project to analyse.
-
reactorProjects
@Parameter(property="reactorProjects", readonly=true) protected java.util.List<MavenProject> reactorProjects
The projects in the reactor for aggregation report.
-
session
@Parameter(defaultValue="${session}", required=true, readonly=true) protected MavenSession session
The current build session instance. This is used for toolchain manager API calls and for dependency resolver API calls.
-
filesToProcess
protected java.util.Map<java.io.File,PmdFileInfo> filesToProcess
The files that are being analyzed.
-
-
Method Detail
-
getProject
protected MavenProject getProject()
- Overrides:
getProject
in classAbstractMavenReport
-
getSiteRenderer
protected Renderer getSiteRenderer()
- Overrides:
getSiteRenderer
in classAbstractMavenReport
-
constructXRefLocation
protected java.lang.String constructXRefLocation(boolean test)
-
getFilesToProcess
protected java.util.Map<java.io.File,PmdFileInfo> getFilesToProcess() throws java.io.IOException
Convenience method to get the list of files where the PMD tool will be executed- Returns:
- a List of the files where the PMD tool will be executed
- Throws:
java.io.IOException
- If an I/O error occurs during construction of the canonical pathnames of the files
-
isXml
protected boolean isXml()
-
canGenerateReport
public boolean canGenerateReport()
- Specified by:
canGenerateReport
in interfaceMavenReport
- Overrides:
canGenerateReport
in classAbstractMavenReport
-
getOutputDirectory
protected java.lang.String getOutputDirectory()
- Overrides:
getOutputDirectory
in classAbstractMavenReport
-
getSourceEncoding
protected java.lang.String getSourceEncoding()
-
getOutputEncoding
protected java.lang.String getOutputEncoding()
Gets the effective reporting output files encoding.- Overrides:
getOutputEncoding
in classAbstractMavenReport
- Returns:
- The effective reporting output file encoding, never
null
. - Since:
- 2.5
-
determineCurrentRootLogLevel
protected java.lang.String determineCurrentRootLogLevel()
-
getToolchain
protected final Toolchain getToolchain()
-
-