zalando/logbook

Duplicate class package-info

jiri-pejchal opened this issue · 1 comments

logbook-core and logbook-api contain the same package org.zolando.logbook with a duplicate class - org/zalando/logbook/package-info.class.

After adding those dependencies, the maven enforcer plugin with the configured rule BanDuplicateClasses fails the build:

[ERROR] Rule 6: org.apache.maven.plugins.enforcer.BanDuplicateClasses failed with the message:
Duplicate classes found:

  Found in:
    org.zalando:logbook-core:jar:2.14.0:compile
    org.zalando:logbook-api:jar:2.14.0:compile
  Duplicate classes:
    org/zalando/logbook/package-info.class

Expected Behavior

Package names should be unique across jars.

Possible Fix

I think it will be fixed as a part of #625 Enable JDK9+ module-info.

Until then, one can use as a workaround the following configuration of the maven enforcer plugin:

<banDuplicateClasses>
   <ignoreClasses>
      <ignoreClass>org.zalando.logbook.package-info</ignoreClass>
   </ignoreClasses>
</banDuplicateClasses>

Steps to Reproduce

The configuration of the maven enforcer plugin:

<plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-enforcer-plugin</artifactId>
   <version>3.1.0</version>
   <executions>
      <execution>
         <id>enforce-versions</id>
         <goals>
            <goal>enforce</goal>
         </goals>
      </execution>
   </executions>
   <configuration>
      <rules>
         <banDuplicateClasses />
      </rules>
   </configuration>
   <dependencies>
      <dependency>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>extra-enforcer-rules</artifactId>
         <version>1.6.1</version>
      </dependency>
   </dependencies>
</plugin>

This should be fixed now as we moved the logbook-core module into its own package (#625).