Uploaded image for project: 'Maven Plugin Tools'
  1. Maven Plugin Tools
  2. MPLUGIN-369

Descriptor generation fails if a Mojo uses Java Records ("UnsupportedOperationException: Record requires ASM8")

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.6.0
    • 3.6.1
    • Plugin Plugin
    • None

    Description

      If a Mojo uses Java Records, then plugin's descriptor generation fails with the following error: "descriptor failed: Record requires ASM8"

      The fix requires upgdating ASM, which is already done in 3.6.1, and creating ASM Class Visitors with an updated API flag, e.g.:

      public MojoClassVisitor( Logger logger )
      {
          super( Opcodes.ASM9 ); // <-- This is currently set to Opcodes.ASM7
          this.logger = logger;
      }

      Error log:

      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-plugin-plugin:3.6.0:descriptor (default-descriptor) on project ***: Execution default-descriptor of goal org.apache.maven.plugins:maven-plugin-plugin:3.6.0:descriptor failed: Record requires ASM8 -> [Help 1]
      org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-plugin-plugin:3.6.0:descriptor (default-descriptor) on project re-app-classifier-generator-plugin: Execution default-descriptor of goal org.apache.maven.plugins:maven-plugin-plugin:3.6.0:descriptor failed: Record requires ASM8
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
          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:56)
          at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
          at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
          at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
          at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
          at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
          at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
          at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
          at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
          at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:64)
          at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke (Method.java:564)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
          at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
          at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
      Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-descriptor of goal org.apache.maven.plugins:maven-plugin-plugin:3.6.0:descriptor failed: Record requires ASM8
          at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:148)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
          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:56)
          at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
          at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
          at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
          at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
          at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
          at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
          at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
          at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
          at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:64)
          at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke (Method.java:564)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
          at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
          at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
      Caused by: java.lang.UnsupportedOperationException: Record requires ASM8
          at org.objectweb.asm.ClassVisitor.visitRecordComponent (ClassVisitor.java:305)
          at org.objectweb.asm.ClassReader.readRecordComponent (ClassReader.java:920)
          at org.objectweb.asm.ClassReader.accept (ClassReader.java:698)
          at org.objectweb.asm.ClassReader.accept (ClassReader.java:394)
          at org.apache.maven.tools.plugin.extractor.annotations.scanner.DefaultMojoAnnotationsScanner.analyzeClassStream (DefaultMojoAnnotationsScanner.java:208)
          at org.apache.maven.tools.plugin.extractor.annotations.scanner.DefaultMojoAnnotationsScanner.scanArchive (DefaultMojoAnnotationsScanner.java:142)
          at org.apache.maven.tools.plugin.extractor.annotations.scanner.DefaultMojoAnnotationsScanner.scan (DefaultMojoAnnotationsScanner.java:111)
          at org.apache.maven.tools.plugin.extractor.annotations.scanner.DefaultMojoAnnotationsScanner.scan (DefaultMojoAnnotationsScanner.java:78)
          at org.apache.maven.tools.plugin.extractor.annotations.JavaAnnotationsMojoDescriptorExtractor.scanAnnotations (JavaAnnotationsMojoDescriptorExtractor.java:124)
          at org.apache.maven.tools.plugin.extractor.annotations.JavaAnnotationsMojoDescriptorExtractor.execute (JavaAnnotationsMojoDescriptorExtractor.java:103)
          at org.apache.maven.tools.plugin.scanner.DefaultMojoScanner.populatePluginDescriptor (DefaultMojoScanner.java:96)
          at org.apache.maven.plugin.plugin.AbstractGeneratorMojo.execute (AbstractGeneratorMojo.java:260)
          at org.apache.maven.plugin.plugin.DescriptorGeneratorMojo.execute (DescriptorGeneratorMojo.java:91)
          at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
          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:56)
          at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
          at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
          at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
          at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
          at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
          at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
          at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
          at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
          at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:64)
          at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke (Method.java:564)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
          at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
          at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
      [ERROR]
      [ERROR]
      [ERROR] For more information about the errors and possible solutions, please read the following articles:
      [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException 

       

      Attachments

        Issue Links

          Activity

            People

              slachiewicz Sylwester Lachiewicz
              alex.shesterov Alex Shesterov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: