org.apache.maven.plugin.pmd
Class CpdViolationCheckMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.apache.maven.plugin.pmd.AbstractPmdViolationCheckMojo<Duplication>
          extended by org.apache.maven.plugin.pmd.CpdViolationCheckMojo
All Implemented Interfaces:
ContextEnabled, Mojo

@Mojo(name="cpd-check",
      defaultPhase=VERIFY,
      threadSafe=true)
@Execute(goal="cpd")
public class CpdViolationCheckMojo
extends AbstractPmdViolationCheckMojo<Duplication>

Fail the build if there were any CPD violations in the source code.

Since:
2.0
Version:
$Id: CpdViolationCheckMojo.html 853015 2013-03-04 21:10:54Z olamy $

Field Summary
protected  boolean failOnViolation
          Whether to fail the build if the validation check fails.
 
Fields inherited from class org.apache.maven.plugin.pmd.AbstractPmdViolationCheckMojo
aggregate, project
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
CpdViolationCheckMojo()
           
 
Method Summary
 void execute()
          
protected  List<Duplication> getErrorDetails(File cpdFile)
          Gets the attributes and text for the violation tag and puts them in a HashMap
protected  int getPriority(Duplication errorDetail)
           
protected  boolean isExcludedFromFailure(Duplication errorDetail)
           
 boolean isFailOnViolation()
           
protected  void loadExcludeFromFailuresData(String excludeFromFailureFile)
           
protected  ViolationDetails<Duplication> newViolationDetailsInstance()
           
protected  void printError(Duplication item, String severity)
          Formats the failure details and prints them as an INFO message
 
Methods inherited from class org.apache.maven.plugin.pmd.AbstractPmdViolationCheckMojo
executeCheck, printErrors
 
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
 

Field Detail

failOnViolation

@Parameter(property="cpd.failOnViolation",
           defaultValue="true",
           required=true)
protected boolean failOnViolation
Whether to fail the build if the validation check fails.

Since:
3.0
Constructor Detail

CpdViolationCheckMojo

public CpdViolationCheckMojo()
Method Detail

execute

public void execute()
             throws MojoExecutionException,
                    MojoFailureException

Throws:
MojoExecutionException
MojoFailureException

printError

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

Specified by:
printError in class AbstractPmdViolationCheckMojo<Duplication>

getErrorDetails

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

Specified by:
getErrorDetails in class AbstractPmdViolationCheckMojo<Duplication>
Throws:
XmlPullParserException
IOException

isExcludedFromFailure

protected boolean isExcludedFromFailure(Duplication errorDetail)
Specified by:
isExcludedFromFailure in class AbstractPmdViolationCheckMojo<Duplication>

loadExcludeFromFailuresData

protected void loadExcludeFromFailuresData(String excludeFromFailureFile)
                                    throws MojoExecutionException
Specified by:
loadExcludeFromFailuresData in class AbstractPmdViolationCheckMojo<Duplication>
Throws:
MojoExecutionException

getPriority

protected int getPriority(Duplication errorDetail)
Specified by:
getPriority in class AbstractPmdViolationCheckMojo<Duplication>

newViolationDetailsInstance

protected ViolationDetails<Duplication> newViolationDetailsInstance()
Specified by:
newViolationDetailsInstance in class AbstractPmdViolationCheckMojo<Duplication>

isFailOnViolation

public boolean isFailOnViolation()
Overrides:
isFailOnViolation in class AbstractPmdViolationCheckMojo<Duplication>


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