Class AbstractPmdViolationCheckMojo<D>

    • Field Detail

      • 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")
        protected boolean aggregate
        Whether to build an aggregated report at the root, or build individual reports.
        Since:
        2.2
    • Constructor Detail

      • AbstractPmdViolationCheckMojo

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

      • getPriority

        protected abstract int getPriority​(D errorDetail)
      • newViolationDetailsInstance

        protected abstract ViolationDetails<D> newViolationDetailsInstance()
      • printErrors

        protected void printErrors​(java.util.List<D> failures,
                                   java.util.List<D> warnings)
        Prints the warnings and failures
        Parameters:
        failures - list of failures
        warnings - list of warnings
      • printError

        protected abstract void printError​(D item,
                                           java.lang.String severity)
        Formats the failure details and prints them as an INFO message
        Parameters:
        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 java.util.List<D> getErrorDetails​(java.io.File analysisFile)
                                                      throws XmlPullParserException,
                                                             java.io.IOException
        Gets the attributes and text for the violation tag and puts them in a HashMap
        Parameters:
        analysisFile - the xml output from PMD or CPD
        Returns:
        all PMD Violations or CPD Duplications.
        Throws:
        XmlPullParserException - if the analysis file contains invalid XML
        java.io.IOException - if the analysis file could be read
      • isFailOnViolation

        public boolean isFailOnViolation()
      • getMaxAllowedViolations

        public java.lang.Integer getMaxAllowedViolations()