Class BannedPlugins

All Implemented Interfaces:
EnforcerRuleBase

@Named("bannedPlugins") public final class BannedPlugins extends AbstractStandardEnforcerRule
This rule checks that lists of plugins are not included.
  • Field Details

    • excludes

      private List<String> excludes
      Specify the banned plugins. This can be a list of plugins in the format groupId[:artifactId][:version]. Any of the sections can be a wildcard by using '*' (ie group:*:1.0)
      The rule will fail if any plugin matches any exclude, unless it also matches an include rule.
    • includes

      private List<String> includes
      Specify the allowed plugins. This can be a list of plugins in the format groupId[:artifactId][:version]. Any of the sections can be a wildcard by using '*' (ie group:*:1.0)
      Includes override the exclude rules. It is meant to allow wide exclusion rules with wildcards and still allow a smaller set of includes.
      For example, to ban all xerces except xerces-api -> exclude "xerces", include "xerces:xerces-api"
    • session

      private final org.apache.maven.execution.MavenSession session
  • Constructor Details

    • BannedPlugins

      @Inject public BannedPlugins(org.apache.maven.execution.MavenSession session)
  • Method Details

    • execute

      public void execute() throws EnforcerRuleException
      Description copied from class: AbstractEnforcerRule
      This is the interface into the rule. This method should throw an exception containing a reason message if the rule fails the check. The plugin will then decide based on the fail flag and rule level if it should stop or just log the message as a warning.
      Specified by:
      execute in class AbstractEnforcerRule
      Throws:
      EnforcerRuleException - the enforcer rule exception
    • validate

      private boolean validate(org.apache.maven.artifact.Artifact artifact)
    • toString

      public String toString()
      Overrides:
      toString in class Object