Class PedanticDependencyElementEnforcer

java.lang.Object
com.github.ferstl.maven.pomenforcers.AbstractPedanticEnforcer
com.github.ferstl.maven.pomenforcers.PedanticDependencyElementEnforcer
All Implemented Interfaces:
org.apache.maven.enforcer.rule.api.EnforcerRule, org.apache.maven.enforcer.rule.api.EnforcerRule2

public class PedanticDependencyElementEnforcer extends AbstractPedanticEnforcer
This enforcer makes sure that elements in the <dependencyManagement> and <dependencies> sections are ordered.
 ### Example
     <rules>
       <dependencyElements implementation="com.github.ferstl.maven.pomenforcers.PedanticDependencyElementEnforcer">
         <!-- Define the order within dependencies -->
         <elementPriorities>groupId,artifactId,version</elementPriorities>
         <!-- Check the dependency management section -->
         <checkDependencyManagement>true</checkDependencyManagement>
         <!-- Check the dependencies section -->
         <checkDependencies>true</checkDependencies>
       </dependencyElements>
     </rules>
 
Since:
2.0.0
Enforcer Rule ID:
PedanticEnforcerRule.DEPENDENCY_ELEMENT
  • Constructor Details

    • PedanticDependencyElementEnforcer

      public PedanticDependencyElementEnforcer()
  • Method Details

    • setElementPriorities

      public void setElementPriorities(String elements)
      Comma-separated list of section elements in the order as they should appear. This will overwrite the default order by putting all unspecified elements at the end.
      Parameters:
      elements - Comma separated list of elements as they should appear.
      Since:
      2.0.0
      Enforcer Configuration Parameter
      Default Value:
      groupId, artifactId, version, classifier, type, scope, systemPath, optional, exclusions
    • setCheckDependencies

      public void setCheckDependencies(boolean checkDependencies)
      Check the <dependencies> section.
      Parameters:
      checkDependencies - true to check the <dependencies> section, false else.
      Since:
      2.0.0
      Enforcer Configuration Parameter
      Default Value:
      true
    • setCheckDependencyManagement

      public void setCheckDependencyManagement(boolean checkDependencyManagement)
      Check the <dependencyManagement> section.
      Parameters:
      checkDependencyManagement - true to check the <dependencyManagement> section, false else.
      Since:
      2.0.0
      Enforcer Configuration Parameter
      Default Value:
      true
    • getDescription

      protected PedanticEnforcerRule getDescription()
      Specified by:
      getDescription in class AbstractPedanticEnforcer
    • doEnforce

      protected void doEnforce(ErrorReport report)
      Specified by:
      doEnforce in class AbstractPedanticEnforcer
    • accept

      protected void accept(PedanticEnforcerVisitor visitor)
      Specified by:
      accept in class AbstractPedanticEnforcer