Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate class package-info #1381

Closed
jiri-pejchal opened this issue Nov 25, 2022 · 1 comment
Closed

Duplicate class package-info #1381

jiri-pejchal opened this issue Nov 25, 2022 · 1 comment
Labels

Comments

@jiri-pejchal
Copy link

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>
@msdousti
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants