Class BanDuplicateClasses

All Implemented Interfaces:
org.apache.maven.enforcer.rule.api.EnforcerRule, org.apache.maven.enforcer.rule.api.EnforcerRule2

public class BanDuplicateClasses extends AbstractResolveDependencies
Bans duplicate classes on the classpath.
  • Field Details

    • DEFAULT_CLASSES_IGNORES

      private static final String[] DEFAULT_CLASSES_IGNORES
      Default ignores which are needed for JDK 9, cause in JDK 9 and above the module-info.class will be duplicated in any jar file. Furthermore in use cases for multi release jars the module-info.class is also contained several times.
    • message

      private String message
      The failure message
    • ignoreClasses

      private String[] ignoreClasses
      List of classes to ignore. Wildcard at the end accepted
    • findAllDuplicates

      private boolean findAllDuplicates
      If false then the rule will fail at the first duplicate, if true then the rule will fail at the end.
    • dependencies

      private List<Dependency> dependencies
      List of dependencies for which you want to ignore specific classes.
    • scopes

      private List<String> scopes
      Only verify dependencies with one of these scopes
    • ignoreWhenIdentical

      private boolean ignoreWhenIdentical
      If true do not fail the build when duplicate classes exactly match each other. In other words, ignore duplication if the bytecode in the class files match. Default is false.
  • Constructor Details

    • BanDuplicateClasses

      public BanDuplicateClasses()
  • Method Details