Klasse AbstractPmdViolationCheckMojo<D>

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.maven.plugins.pmd.AbstractPmdViolationCheckMojo<D>
Typparameter:
D - type of the check, e.g. Violation or Duplication.
Alle implementierten Schnittstellen:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Bekannte direkte Unterklassen:
CpdViolationCheckMojo, PmdViolationCheckMojo

public abstract class AbstractPmdViolationCheckMojo<D> extends org.apache.maven.plugin.AbstractMojo
Base class for mojos that check if there were any PMD violations.
Version:
$Id$
Autor:
Brett Porter
  • Feldübersicht

    Felder
    Modifizierer und Typ
    Feld
    Beschreibung
    protected boolean
    Veraltet.
    since 3.15.0 Use the goal pmd:aggregate-check or pmd:aggregate-cpd-check instead.
    protected boolean
    Whether to fail the build if the validation check fails.
    protected org.apache.maven.project.MavenProject
    The project to analyze.

    Von Schnittstelle geerbte Felder org.apache.maven.plugin.Mojo

    ROLE
  • Konstruktorübersicht

    Konstruktoren
    Modifizierer
    Konstruktor
    Beschreibung
    protected
    Initialize this abstact check mojo by giving the correct ExcludeFromFile helper.
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    protected void
    executeCheck(String filename, String tagName, String key, int failurePriority)
     
    protected abstract List<D>
    getErrorDetails(File analysisFile)
    Gets the attributes and text for the violation tag and puts them in a HashMap
     
    protected abstract int
    getPriority(D errorDetail)
     
    protected boolean
     
    boolean
     
    protected abstract ViolationDetails<D>
     
    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

    Von Klasse geerbte Methoden org.apache.maven.plugin.AbstractMojo

    getLog, getPluginContext, setLog, setPluginContext

    Von Klasse geerbte Methoden java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Von Schnittstelle geerbte Methoden org.apache.maven.plugin.Mojo

    execute
  • Felddetails

    • failOnViolation

      @Parameter(property="pmd.failOnViolation", defaultValue="true", required=true) protected boolean failOnViolation
      Whether to fail the build if the validation check fails. The properties failurePriority and maxAllowedViolations control under which conditions exactly the build should be failed.
    • aggregate

      @Parameter(property="aggregate", defaultValue="false") @Deprecated protected boolean aggregate
      Veraltet.
      since 3.15.0 Use the goal pmd:aggregate-check or pmd:aggregate-cpd-check instead.
      Whether to build an aggregated report at the root, or build individual reports.
      Seit:
      2.2
    • project

      @Parameter(defaultValue="${project}", readonly=true, required=true) protected org.apache.maven.project.MavenProject project
      The project to analyze.
  • Konstruktordetails

    • AbstractPmdViolationCheckMojo

      protected AbstractPmdViolationCheckMojo(ExcludeFromFile<D> excludeFromFile)
      Initialize this abstact check mojo by giving the correct ExcludeFromFile helper.
      Parameter:
      excludeFromFile - the needed helper, for the specific violation type
  • Methodendetails

    • executeCheck

      protected void executeCheck(String filename, String tagName, String key, int failurePriority) throws org.apache.maven.plugin.MojoFailureException, org.apache.maven.plugin.MojoExecutionException
      Löst aus:
      org.apache.maven.plugin.MojoFailureException
      org.apache.maven.plugin.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
      Parameter:
      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
      Parameter:
      item - either a Violation from PMD or a Duplication from CPD
      severity - the found issue is prefixed with the given severity, usually "Warning" or "Failure".
    • getErrorDetails

      protected abstract List<D> getErrorDetails(File analysisFile) throws org.codehaus.plexus.util.xml.pull.XmlPullParserException, IOException
      Gets the attributes and text for the violation tag and puts them in a HashMap
      Parameter:
      analysisFile - the xml output from PMD or CPD
      Gibt zurück:
      all PMD Violations or CPD Duplications.
      Löst aus:
      org.codehaus.plexus.util.xml.pull.XmlPullParserException - if the analysis file contains invalid XML
      IOException - if the analysis file could be read
    • isFailOnViolation

      public boolean isFailOnViolation()
    • getMaxAllowedViolations

      public Integer getMaxAllowedViolations()
    • isAggregator

      protected boolean isAggregator()