extra-enforcer-rules icon indicating copy to clipboard operation
extra-enforcer-rules copied to clipboard

banDuplicateClasses does not support exclusions on runtime scope dependencies

Open josple opened this issue 5 years ago • 1 comments

Impacts version: 3.0.0-M3

Assume group1:artifact1 has duplicate classes and that removing its group2:artifact2 transitive dependency is a way of resolving this duplicate class clash.

The banDuplicateClasses rule will pass with the following:

 ....
   <dependency>
      <groupId>group1</groupId>
      <artifactId>artifact1</artifactId>
      <exclusions>
        <exclusion>
          <groupId>group2</groupId>
          <artifactId>artifact2</artifactId>
        </exclusion>
      </exclusions>
      <scope>compile</scope>
    </dependency>
 ...

But it will not pass when the dependency is declared with runtime scope:

 ....
   <dependency>
      <groupId>group1</groupId>
      <artifactId>artifact1</artifactId>
      <exclusions>
        <exclusion>
          <groupId>group2</groupId>
          <artifactId>artifact2</artifactId>
        </exclusion>
      </exclusions>
      <scope>runtime</scope>
    </dependency>
 ...

josple avatar Aug 14 '20 16:08 josple

can you provide a example which can be executed to confirm?

slawekjaranowski avatar Jun 26 '22 15:06 slawekjaranowski