Package org.apache.maven.plugins.pmd
Klasse CpdViolationCheckMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.maven.plugins.pmd.AbstractPmdViolationCheckMojo<Duplication>
org.apache.maven.plugins.pmd.CpdViolationCheckMojo
- Alle implementierten Schnittstellen:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
- Bekannte direkte Unterklassen:
AggregatorCpdViolationCheckMojo
@Mojo(name="cpd-check",
defaultPhase=VERIFY,
threadSafe=true)
@Execute(goal="cpd")
public class CpdViolationCheckMojo
extends AbstractPmdViolationCheckMojo<Duplication>
Fails the build if there were any CPD violations in the source code.
- Seit:
- 2.0
- Version:
- $Id$
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungprotected boolean
Whether to fail the build if the validation check fails.Von Klasse geerbte Felder org.apache.maven.plugins.pmd.AbstractPmdViolationCheckMojo
aggregate, project
Von Schnittstelle geerbte Felder org.apache.maven.plugin.Mojo
ROLE
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
execute()
protected List
<Duplication> getErrorDetails
(File cpdFile) Gets the attributes and text for the violation tag and puts them in a HashMapprotected int
getPriority
(Duplication errorDetail) boolean
protected ViolationDetails
<Duplication> protected void
printError
(Duplication item, String severity) Formats the failure details and prints them as an INFO messageVon Klasse geerbte Methoden org.apache.maven.plugins.pmd.AbstractPmdViolationCheckMojo
executeCheck, getMaxAllowedViolations, isAggregator, printErrors
Von Klasse geerbte Methoden org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Felddetails
-
failOnViolation
@Parameter(property="cpd.failOnViolation", defaultValue="true", required=true) protected boolean failOnViolationWhether to fail the build if the validation check fails.- Seit:
- 3.0
-
-
Konstruktordetails
-
CpdViolationCheckMojo
public CpdViolationCheckMojo()Default constructor. Initializes with the correctExcludeDuplicationsFromFile
.
-
-
Methodendetails
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Löst aus:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
-
printError
Formats the failure details and prints them as an INFO message- Angegeben von:
printError
in KlasseAbstractPmdViolationCheckMojo<Duplication>
- Parameter:
item
- either aViolation
from PMD or aDuplication
from CPDseverity
- the found issue is prefixed with the given severity, usually "Warning" or "Failure".
-
getErrorDetails
protected List<Duplication> getErrorDetails(File cpdFile) throws org.codehaus.plexus.util.xml.pull.XmlPullParserException, IOException Gets the attributes and text for the violation tag and puts them in a HashMap- Angegeben von:
getErrorDetails
in KlasseAbstractPmdViolationCheckMojo<Duplication>
- Parameter:
cpdFile
- the xml output from PMD or CPD- Gibt zurück:
- all PMD
Violation
s or CPDDuplication
s. - Löst aus:
org.codehaus.plexus.util.xml.pull.XmlPullParserException
- if the analysis file contains invalid XMLIOException
- if the analysis file could be read
-
getPriority
- Angegeben von:
getPriority
in KlasseAbstractPmdViolationCheckMojo<Duplication>
-
newViolationDetailsInstance
- Angegeben von:
newViolationDetailsInstance
in KlasseAbstractPmdViolationCheckMojo<Duplication>
-
isFailOnViolation
public boolean isFailOnViolation()- Setzt außer Kraft:
isFailOnViolation
in KlasseAbstractPmdViolationCheckMojo<Duplication>
-