ContextEnabled
, Mojo
@Mojo(name="cpd-check", defaultPhase=VERIFY, threadSafe=true) @Execute(goal="cpd") public class CpdViolationCheckMojo extends AbstractPmdViolationCheckMojo<Duplication>
Modifier and Type | Field | Description |
---|---|---|
protected boolean |
failOnViolation |
Whether to fail the build if the validation check fails.
|
aggregate, project
Constructor | Description |
---|---|
CpdViolationCheckMojo() |
Default constructor.
|
Modifier and Type | Method | Description |
---|---|---|
void |
execute() |
|
protected java.util.List<Duplication> |
getErrorDetails(java.io.File cpdFile) |
Gets the attributes and text for the violation tag and puts them in a HashMap
|
protected int |
getPriority(Duplication errorDetail) |
|
boolean |
isFailOnViolation() |
|
protected ViolationDetails<Duplication> |
newViolationDetailsInstance() |
|
protected void |
printError(Duplication item,
java.lang.String severity) |
Formats the failure details and prints them as an INFO message
|
getLog, getPluginContext, setLog, setPluginContext
executeCheck, getMaxAllowedViolations, printErrors
@Parameter(property="cpd.failOnViolation", defaultValue="true", required=true) protected boolean failOnViolation
public CpdViolationCheckMojo()
ExcludeDuplicationsFromFile
.public void execute() throws MojoExecutionException, MojoFailureException
protected void printError(Duplication item, java.lang.String severity)
printError
in class AbstractPmdViolationCheckMojo<Duplication>
item
- either a Violation
from PMD
or a Duplication
from CPDseverity
- the found issue is prefixed with the given severity, usually "Warning" or "Failure".protected java.util.List<Duplication> getErrorDetails(java.io.File cpdFile) throws XmlPullParserException, java.io.IOException
getErrorDetails
in class AbstractPmdViolationCheckMojo<Duplication>
cpdFile
- the xml output from PMD or CPDViolation
s
or CPD Duplication
s.XmlPullParserException
- if the analysis file contains invalid XMLjava.io.IOException
- if the analysis file could be readprotected int getPriority(Duplication errorDetail)
getPriority
in class AbstractPmdViolationCheckMojo<Duplication>
protected ViolationDetails<Duplication> newViolationDetailsInstance()
newViolationDetailsInstance
in class AbstractPmdViolationCheckMojo<Duplication>
public boolean isFailOnViolation()
isFailOnViolation
in class AbstractPmdViolationCheckMojo<Duplication>
Copyright © 2005–2018 The Apache Software Foundation. All rights reserved.