Class BannedDependencies

All Implemented Interfaces:
EnforcerRule, EnforcerRule2
Direct Known Subclasses:
BannedPlugins

public class BannedDependencies extends AbstractBanDependencies
This rule checks that lists of dependencies are not included.
  • Field Details

    • excludes

      private List<String> excludes
      Specify the banned dependencies. This can be a list of artifacts 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 dependency matches any exclude, unless it also matches an include rule.
    • includes

      private List<String> includes
      Specify the allowed dependencies. This can be a list of artifacts 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"
  • Constructor Details

    • BannedDependencies

      public BannedDependencies()
  • Method Details

    • checkDependencies

      protected Set<org.apache.maven.artifact.Artifact> checkDependencies(Set<org.apache.maven.artifact.Artifact> theDependencies, org.apache.maven.plugin.logging.Log log) throws EnforcerRuleException
      Description copied from class: AbstractBanDependencies
      Checks the set of dependencies against the list of excludes.
      Specified by:
      checkDependencies in class AbstractBanDependencies
      Parameters:
      theDependencies - the dependencies
      log - the log
      Returns:
      the sets the
      Throws:
      EnforcerRuleException - the enforcer rule exception
    • getExcludes

      public List<String> getExcludes()
      Gets the excludes.
      Returns:
      the excludes
    • setExcludes

      public void setExcludes(List<String> theExcludes)
      Specify the banned dependencies. This can be a list of artifacts 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 dependency matches any exclude, unless it also matches an include rule.
      Parameters:
      theExcludes - the excludes to set
      See Also:
    • getIncludes

      public List<String> getIncludes()
      Gets the includes.
      Returns:
      the includes
    • setIncludes

      public void setIncludes(List<String> theIncludes)
      Specify the allowed dependencies. This can be a list of artifacts 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"
      Parameters:
      theIncludes - the includes to set
      See Also: