org.apache.maven.plugin.pmd
Class AbstractPmdReport

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

public abstract class AbstractPmdReport
extends AbstractMavenReport

Base class for the PMD reports.

Version:
$Id: AbstractPmdReport.html 853015 2013-03-04 21:10:54Z olamy $
Author:
Brett Porter

Field Summary
protected  boolean aggregate
          Whether to build an aggregated report at the root, or build individual reports.
protected  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  File outputDirectory
          The output directory for the final HTML report.
protected  MavenProject project
          The project to analyse.
protected  List<MavenProject> reactorProjects
          The projects in the reactor for aggregation report.
protected  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
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractPmdReport()
           
 
Method Summary
 boolean canGenerateReport()
          
protected  String constructXRefLocation(boolean test)
           
protected  Map<File,PmdFileInfo> getFilesToProcess()
          Convenience method to get the list of files where the PMD tool will be executed
protected  String getOutputDirectory()
          
protected  String getOutputEncoding()
          Gets the effective reporting output files encoding.
protected  MavenProject getProject()
          
protected  Renderer getSiteRenderer()
          
protected  String getSourceEncoding()
           
protected  boolean isHtml()
           
 
Methods inherited from class org.apache.maven.reporting.AbstractMavenReport
closeReport, execute, executeReport, generate, generate, generate, getCategoryName, 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 File targetDirectory
The output directory for the intermediate XML report.


outputDirectory

@Parameter(property="project.reporting.outputDirectory",
           required=true)
protected 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.


project

@Component
protected MavenProject project
The project to analyse.


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 required if the pmd:check goal is being used.


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

reactorProjects

@Parameter(property="reactorProjects",
           readonly=true)
protected List<MavenProject> reactorProjects
The projects in the reactor for aggregation report.


includeXmlInSite

@Parameter(defaultValue="false")
protected boolean includeXmlInSite
Whether to include the xml files generated by PMD/CPD in the site.
Note: In versions 2.2 - 2.7.1 the default value for this was true. This was changed in version 3.0.

Since:
3.0
Constructor Detail

AbstractPmdReport

public AbstractPmdReport()
Method Detail

getProject

protected MavenProject getProject()

Specified by:
getProject in class AbstractMavenReport

getSiteRenderer

protected Renderer getSiteRenderer()

Specified by:
getSiteRenderer in class AbstractMavenReport

constructXRefLocation

protected String constructXRefLocation(boolean test)

getFilesToProcess

protected Map<File,PmdFileInfo> getFilesToProcess()
                                           throws 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:
IOException

isHtml

protected boolean isHtml()

canGenerateReport

public boolean canGenerateReport()

Specified by:
canGenerateReport in interface MavenReport
Overrides:
canGenerateReport in class AbstractMavenReport

getOutputDirectory

protected String getOutputDirectory()

Specified by:
getOutputDirectory in class AbstractMavenReport

getSourceEncoding

protected String getSourceEncoding()

getOutputEncoding

protected String getOutputEncoding()
Gets the effective reporting output files encoding.

Returns:
The effective reporting output file encoding, never null.
Since:
2.5


Copyright © 2005-2013 The Apache Software Foundation. All Rights Reserved.