Class PedanticPluginElementEnforcer

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

public class PedanticPluginElementEnforcer extends AbstractPedanticEnforcer
This enforcer makes sure that elements in the <pluginManagement> and <plugins> sections are ordered.
 ### Example
     <rules>
       <pluginElements implementation="com.github.ferstl.maven.pomenforcers.PedanticPluginElementEnforcer">
         <!-- Define the order within plugins -->
         <elementPriorities>groupId,artifactId,version</elementPriorities>
         <!-- Check the plugin management section -->
         <checkPluginManagement>true</checkPluginManagement>
         <!-- Check the plugins section -->
         <checkPlugins>true</checkPlugins>
       </pluginElements>
     </rules>
 
Since:
2.0.0
Enforcer Rule ID:
PedanticEnforcerRule.PLUGIN_ELEMENT
  • Constructor Details

    • PedanticPluginElementEnforcer

      public PedanticPluginElementEnforcer()
  • 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, extensions, inherited, configuration, dependencies, executions
    • setCheckPlugins

      public void setCheckPlugins(boolean checkPlugins)
      Check the <plugins> section.
      Parameters:
      checkPlugins - true to check the <plugins> section, false else.
      Since:
      2.0.0
      Enforcer Configuration Parameter
      Default Value:
      true
    • setCheckPluginManagement

      public void setCheckPluginManagement(boolean checkPluginManagement)
      Check the <pluginManagement> section.
      Parameters:
      checkPluginManagement - true to check the <pluginManagement> 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