Class PedanticPluginManagementOrderEnforcer

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

public class PedanticPluginManagementOrderEnforcer extends AbstractPedanticEnforcer
This enforcer makes sure that all plugins in your plugin management section are ordered. The ordering can be defined by any combination of groupId and artifactId. Each of these attributes may be given a priority.
 ### Example
     <rules>
       <pluginManagementOrder implementation="com.github.ferstl.maven.pomenforcers.PedanticPluginManagementOrderEnforcer">
         <!-- order by groupId and artifactId (default) -->
         <orderBy>groupId,artifactId</orderBy>
         <!-- all group IDs starting with com.myproject.plugins and com.myproject.testplugins should occur first -->
         <groupIdPriorities>com.myproject.plugins,com.myproject.testplugins</groupIdPriorities>
         <!-- all artifact IDs starting with mytest and myintegrationtest should occur first -->
         <artifactIdPriorities>mytest-,myintegrationtest-</artifactIdPriorities>
       </pluginManagementOrder>
     </rules>
 
Since:
1.0.0
Enforcer Rule ID:
PedanticEnforcerRule.PLUGIN_MANAGEMENT_ORDER
  • Constructor Details

    • PedanticPluginManagementOrderEnforcer

      public PedanticPluginManagementOrderEnforcer()
  • Method Details

    • setOrderBy

      public void setOrderBy(String pluginElements)
      Comma-separated list of plugin elements that defines the ordering.
      Parameters:
      pluginElements - Comma-separated list of plugin elements that defines the ordering.
      Since:
      1.0.0
      Enforcer Configuration Parameter
      Default Value:
      groupId, artifactId
    • setGroupIdPriorities

      public void setGroupIdPriorities(String groupIds)
      Comma-separated list of group IDs that should be listed first in the plugins declaration. All group IDs that start with any of the prioritized group IDs in the given list, are required to be located first in the dependencies section.
      Parameters:
      groupIds - Comma separated list of group IDs.
      Since:
      1.0.0
      Enforcer Configuration Parameter
      Default Value:
      n/a
    • setArtifactIdPriorities

      public void setArtifactIdPriorities(String artifactIds)
      Comma-separated list of artifact IDs that should be listed first in the plugins declaration. All artifact IDs that start with any of the prioritized IDs in the given list, are required to be located first in the dependencies section.
      Parameters:
      artifactIds - Comma separated list of artifact IDs.
      Since:
      1.0.0
      Enforcer Configuration Parameter
      Default Value:
      n/a
    • getDescription

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

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

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