Uploaded image for project: 'Maven Shade Plugin'
  1. Maven Shade Plugin
  2. MSHADE-258

RemappingClassAdapter is deprecated and throws an exception with ASM 6.0 beta

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.0
    • Fix Version/s: 3.1.0
    • Labels:
      None

      Description

      While trying to use the maven shade plugin with ASM 6.0 beta (for Java 9 support) in the easymock project, I ran into the following exception:

      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.0.0:shade (default) on project easymock: Error creating shaded jar: Error in ASM processing class module-info.class: RemappingClassAdapter is deprecated, use ClassRemapper instead -> [Help 1]
      org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.0.0:shade (default) on project easymock: Error creating shaded jar: Error in ASM processing class module-info.class
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
      	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
      	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
      	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
      	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
      	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
      	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
      	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
      	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
      	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
      	at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
      Caused by: org.apache.maven.plugin.MojoExecutionException: Error creating shaded jar: Error in ASM processing class module-info.class
      	at org.apache.maven.plugins.shade.mojo.ShadeMojo.execute(ShadeMojo.java:546)
      	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
      	... 20 more
      Caused by: org.apache.maven.plugin.MojoExecutionException: Error in ASM processing class module-info.class
      	at org.apache.maven.plugins.shade.DefaultShader.addRemappedClass(DefaultShader.java:453)
      	at org.apache.maven.plugins.shade.DefaultShader.shadeSingleJar(DefaultShader.java:220)
      	at org.apache.maven.plugins.shade.DefaultShader.shadeJars(DefaultShader.java:181)
      	at org.apache.maven.plugins.shade.DefaultShader.shade(DefaultShader.java:104)
      	at org.apache.maven.plugins.shade.mojo.ShadeMojo.execute(ShadeMojo.java:442)
      	... 22 more
      Caused by: java.lang.RuntimeException: RemappingClassAdapter is deprecated, use ClassRemapper instead
      	at org.objectweb.asm.commons.RemappingClassAdapter.visitModule(Unknown Source)
      	at org.objectweb.asm.ClassReader.a(Unknown Source)
      	at org.objectweb.asm.ClassReader.accept(Unknown Source)
      	at org.objectweb.asm.ClassReader.accept(Unknown Source)
      	at org.apache.maven.plugins.shade.DefaultShader.addRemappedClass(DefaultShader.java:449)
      

      Link to the exception:

      https://gitlab.ow2.org/asm/asm/blob/master/src/org/objectweb/asm/commons/RemappingClassAdapter.java#L75

      Link to the change that deprecated the class:

      https://gitlab.ow2.org/asm/asm/commit/54303379f52c7ea84affbf6142e0f4c4be9127c3

        Issue Links

          Activity

          Hide
          rfscholte Robert Scholte added a comment -

          MSHADE-242 is happening in case of minifying the jar, this issue happens when relocating classes of jars with a module descriptor. This will also mean that it'll break the intended strong encapsulation.
          Java 9 will not provide a solution for that yet, so I guess we'll have to log a warning as well.

          Show
          rfscholte Robert Scholte added a comment - MSHADE-242 is happening in case of minifying the jar, this issue happens when relocating classes of jars with a module descriptor. This will also mean that it'll break the intended strong encapsulation. Java 9 will not provide a solution for that yet, so I guess we'll have to log a warning as well.
          Hide
          ijuma Ismael Juma added a comment - - edited

          Makes sense. Interestingly that error happened after the following line:

          [DEBUG] Processing JAR /Users/ijuma/.m2/repository/org/ow2/asm/asm/6.0_BETA/asm-6.0_BETA.jar
          

          And we can verify that the JAR contains module-info.class:

          jar tf asm-6.0_BETA.jar | grep module
          module-info.class
          

          So, it seems like any project relocating ASM 6.0 will run into issues.

          Show
          ijuma Ismael Juma added a comment - - edited Makes sense. Interestingly that error happened after the following line: [DEBUG] Processing JAR /Users/ijuma/.m2/repository/org/ow2/asm/asm/6.0_BETA/asm-6.0_BETA.jar And we can verify that the JAR contains module-info.class: jar tf asm-6.0_BETA.jar | grep module module-info.class So, it seems like any project relocating ASM 6.0 will run into issues.
          Hide
          rfscholte Robert Scholte added a comment -

          Verified with r1805503
          Code change committed as part of MSHADE-242

          Show
          rfscholte Robert Scholte added a comment - Verified with r1805503 Code change committed as part of MSHADE-242
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Jenkins build maven-plugins #9072 (See https://builds.apache.org/job/maven-plugins/9072/)
          MSHADE-258 RemappingClassAdapter is deprecated and throws an exception with ASM 6.0 beta
          Provide IT (rfscholte: http://svn.apache.org/viewvc/?view=rev&rev=1805503)

          • (add) maven-shade-plugin/src/it/MSHADE-258_module_relocation
          • (add) maven-shade-plugin/src/it/MSHADE-258_module_relocation/pom.xml
          • (add) maven-shade-plugin/src/it/MSHADE-258_module_relocation/verify.groovy
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build maven-plugins #9072 (See https://builds.apache.org/job/maven-plugins/9072/ ) MSHADE-258 RemappingClassAdapter is deprecated and throws an exception with ASM 6.0 beta Provide IT (rfscholte: http://svn.apache.org/viewvc/?view=rev&rev=1805503 ) (add) maven-shade-plugin/src/it/ MSHADE-258 _module_relocation (add) maven-shade-plugin/src/it/ MSHADE-258 _module_relocation/pom.xml (add) maven-shade-plugin/src/it/ MSHADE-258 _module_relocation/verify.groovy

            People

            • Assignee:
              rfscholte Robert Scholte
              Reporter:
              ijuma Ismael Juma
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development