org.apache.maven.plugin.pmd
Class AbstractPmdViolationCheckMojo<D>

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.apache.maven.plugin.pmd.AbstractPmdViolationCheckMojo<D>
All Implemented Interfaces:
ContextEnabled, Mojo
Direct Known Subclasses:
CpdViolationCheckMojo, PmdViolationCheckMojo

public abstract class AbstractPmdViolationCheckMojo<D>
extends AbstractMojo

Base class for mojos that check if there were any PMD violations.

Version:
$Id: AbstractPmdViolationCheckMojo.html 816698 2012-05-08 15:21:08Z hboutemy $
Author:
Brett Porter

Field Summary
protected  boolean aggregate
          Whether to build an aggregated report at the root, or build individual reports.
protected  MavenProject project
          The project to analyze.
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractPmdViolationCheckMojo()
           
 
Method Summary
protected  void executeCheck(String filename, String tagName, String key, int failurePriority)
           
protected abstract  List<D> getErrorDetails(File analisysFile)
          Gets the attributes and text for the violation tag and puts them in a HashMap
protected abstract  int getPriority(D errorDetail)
           
protected abstract  ViolationDetails<D> newViolationDetailsInstance()
           
protected abstract  void printError(D item, String severity)
          Formats the failure details and prints them as an INFO message
protected  void printErrors(List<D> failures, List<D> warnings)
          Prints the warnings and failures
 
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.plugin.Mojo
execute
 

Field Detail

aggregate

protected boolean aggregate
Whether to build an aggregated report at the root, or build individual reports.

Since:
2.2
Is defined by:
expression:
${aggregate}
default-value:
false

project

protected MavenProject project
The project to analyze.

Is defined by:
expression:
${project}
Is readonly.
Is required.
Constructor Detail

AbstractPmdViolationCheckMojo

public AbstractPmdViolationCheckMojo()
Method Detail

executeCheck

protected void executeCheck(String filename,
                            String tagName,
                            String key,
                            int failurePriority)
                     throws MojoFailureException,
                            MojoExecutionException
Throws:
MojoFailureException
MojoExecutionException

getPriority

protected abstract int getPriority(D errorDetail)

newViolationDetailsInstance

protected abstract ViolationDetails<D> newViolationDetailsInstance()

printErrors

protected void printErrors(List<D> failures,
                           List<D> warnings)
Prints the warnings and failures

Parameters:
failures - list of failures
warnings - list of warnings

printError

protected abstract void printError(D item,
                                   String severity)
Formats the failure details and prints them as an INFO message

Parameters:
item -

getErrorDetails

protected abstract List<D> getErrorDetails(File analisysFile)
                                    throws XmlPullParserException,
                                           IOException
Gets the attributes and text for the violation tag and puts them in a HashMap

Parameters:
xpp -
Throws:
XmlPullParserException
IOException


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