module-info.java from com.google.gson included in nimbus-jose-jwt.jar from version 9.24

Issue #496 resolved
Former user created an issue

The class module-info.java should not be packed into the jar by the dependency com.google.gson, this leads to problems with Java 11.

The problem should be solved with the following patch:

--- pom.xml   2022-10-11 10:20:47.704000000 +0200
+++ pom.xml    2022-10-11 10:21:26.745225300 +0200
@@ -157,6 +157,9 @@
                         <relocation>
                             <pattern>com.google.gson</pattern>
                             <shadedPattern>com.nimbusds.jose.shaded.gson</shadedPattern>
+                            <excludes>
+                                <exclude>module-info.class</exclude>
+                            </excludes>
                         </relocation>
                     </relocations>
                     <artifactSet>

Comments (12)

  1. Sebastian Stenzel

    In a private message I suggested using <filters> (which I know to work in a different project):

    <relocations>
       <relocation>
          <pattern>com.google.gson</pattern>
          <shadedPattern>com.nimbusds.jose.shaded.gson</shadedPattern>
       </relocation>
    </relocations>
    <filters>
       <filter>
          <artifact>com.google.code.gson:gson</artifact>
          <excludes>
             <exclude>**/module-info.class</exclude> <!-- not sure if we need **/ -->
          </excludes>
       </filter>
    </filters>
    

    See docs: https://maven.apache.org/plugins/maven-shade-plugin/shade-mojo.html#filters

    If a fix really works can btw easily be verified by unzipping the produced jar.

  2. Vladimir Dzhuvinov

    @Arjan Tijms Would you be able to submit a PR with a fix? We don’t use modules here and I don’t know what could be done about that.

  3. Vladimir Dzhuvinov

    Thank you! The PR is merged now and I’m marking the issue as closed, hopefully once and for all 🙂

    version 9.37.1 (2023-11-08)
        * The module-info.java from the shaded Gson dependency must not be packed
          into the published JAR (iss #496).
    

  4. Log in to comment