D - type of the check, e.g. Violation
or Duplication.public abstract class AbstractPmdViolationCheckMojo<D>
extends org.apache.maven.plugin.AbstractMojo
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
aggregate
Deprecated.
since 3.15.0 Use the goal
pmd:aggregate-check or
pmd:aggregate-cpd-check instead. |
protected boolean |
failOnViolation
Whether to fail the build if the validation check fails.
|
protected org.apache.maven.project.MavenProject |
project
The project to analyze.
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractPmdViolationCheckMojo(ExcludeFromFile<D> excludeFromFile)
Initialize this abstact check mojo by giving the correct ExcludeFromFile helper.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
executeCheck(String filename,
String analyzerName,
String failureName,
int failurePriority) |
protected abstract List<D> |
getErrorDetails(File analysisFile)
Gets the attributes and text for the violation tag and puts them in a HashMap
|
Integer |
getMaxAllowedViolations() |
protected abstract int |
getPriority(D errorDetail) |
protected boolean |
isAggregator() |
boolean |
isFailOnViolation() |
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
|
getLog, getPluginContext, setLog, setPluginContext@Parameter(property="pmd.failOnViolation",
defaultValue="true",
required=true)
protected boolean failOnViolation
failurePriority and maxAllowedViolations control
under which conditions exactly the build should be failed.@Parameter(property="aggregate",
defaultValue="false")
@Deprecated
protected boolean aggregate
pmd:aggregate-check or
pmd:aggregate-cpd-check instead.@Parameter(defaultValue="${project}",
readonly=true,
required=true)
protected org.apache.maven.project.MavenProject project
protected AbstractPmdViolationCheckMojo(ExcludeFromFile<D> excludeFromFile)
excludeFromFile - the needed helper, for the specific violation typeprotected void executeCheck(String filename, String analyzerName, String failureName, int failurePriority) throws org.apache.maven.plugin.MojoFailureException, org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureExceptionorg.apache.maven.plugin.MojoExecutionExceptionprotected abstract int getPriority(D errorDetail)
protected abstract ViolationDetails<D> newViolationDetailsInstance()
protected void printErrors(List<D> failures, List<D> warnings)
failures - list of failureswarnings - list of warningsprotected abstract void printError(D item, String severity)
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 abstract List<D> getErrorDetails(File analysisFile) throws org.codehaus.plexus.util.xml.pull.XmlPullParserException, IOException
analysisFile - the xml output from PMD or CPDViolations
or CPD Duplications.org.codehaus.plexus.util.xml.pull.XmlPullParserException - if the analysis file contains invalid XMLIOException - if the analysis file could be readpublic boolean isFailOnViolation()
public Integer getMaxAllowedViolations()
protected boolean isAggregator()
Copyright © 2005–2024 The Apache Software Foundation. All rights reserved.