[ https://issues.apache.org/jira/browse/MPLUGIN-312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15439708#comment-15439708 ]
Yegor Borovikov commented on MPLUGIN-312: ----------------------------------------- [~rfscholte], thank you for quick resolution! > maven-plugin-tools-annotations visitors fail scanning java8 annotations > ----------------------------------------------------------------------- > > Key: MPLUGIN-312 > URL: https://issues.apache.org/jira/browse/MPLUGIN-312 > Project: Maven Plugin Tools > Issue Type: Bug > Components: maven-plugin-tools-annotations > Affects Versions: 3.4 > Reporter: Yegor Borovikov > Assignee: Robert Scholte > Fix For: 3.5 > > Attachments: MPLUGIN-312-maven-plugin-tools-annotations.patch, > java6-plugin.zip > > > Custom (Java 6) Maven plugin (relying on Java 5 annotations to generate the > plugin descriptor file) with dependencies that have Java 8 classes (not > necessarily referenced by plugin code - just present in the jars) which use > Java 8 type-use or type-parameter annotations fails on `generate:descriptor` > goal: > {noformat} > $ mvn plugin:descriptor -e > [INFO] Error stacktraces are turned on. > [INFO] Scanning for projects... > [INFO] > > [INFO] > ------------------------------------------------------------------------ > [INFO] Building java6-plugin 0.0-SNAPSHOT > [INFO] > ------------------------------------------------------------------------ > [INFO] > [INFO] --- maven-plugin-plugin:3.4:descriptor (default-cli) @ java6-plugin --- > [INFO] Using 'UTF-8' encoding to read mojo metadata. > [INFO] > ------------------------------------------------------------------------ > [INFO] BUILD FAILURE > [INFO] > ------------------------------------------------------------------------ > [INFO] Total time: 1.022 s > [INFO] Finished at: 2016-08-25T17:14:54-07:00 > [INFO] Final Memory: 10M/245M > [INFO] > ------------------------------------------------------------------------ > [ERROR] Failed to execute goal > org.apache.maven.plugins:maven-plugin-plugin:3.4:descriptor (default-cli) on > project java6-plugin: Execution default-cli of goal > org.apache.maven.plugins:maven-plugin-plugin:3.4:descriptor failed. > RuntimeException -> [Help 1] > org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute > goal org.apache.maven.plugins:maven-plugin-plugin:3.4:descriptor > (default-cli) on project java6-plugin: Execution default-cli of goal > org.apache.maven.plugins:maven-plugin-plugin:3.4:descriptor failed. > at > org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224) > at > org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) > at > org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) > at > org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) > at > org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) > 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:307) > at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) > at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) > at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862) > at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286) > at org.apache.maven.cli.MavenCli.main(MavenCli.java:197) > 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.PluginExecutionException: Execution > default-cli of goal > org.apache.maven.plugins:maven-plugin-plugin:3.4:descriptor failed. > at > org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145) > at > org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) > ... 20 more > Caused by: java.lang.RuntimeException > at org.objectweb.asm.FieldVisitor.visitTypeAnnotation(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.tools.plugin.extractor.annotations.scanner.DefaultMojoAnnotationsScanner.analyzeClassStream(DefaultMojoAnnotationsScanner.java:202) > at > org.apache.maven.tools.plugin.extractor.annotations.scanner.DefaultMojoAnnotationsScanner.scanArchive(DefaultMojoAnnotationsScanner.java:139) > at > org.apache.maven.tools.plugin.extractor.annotations.scanner.DefaultMojoAnnotationsScanner.scan(DefaultMojoAnnotationsScanner.java:108) > at > org.apache.maven.tools.plugin.extractor.annotations.scanner.DefaultMojoAnnotationsScanner.scan(DefaultMojoAnnotationsScanner.java:75) > 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:245) > at > org.apache.maven.plugin.plugin.DescriptorGeneratorMojo.execute(DescriptorGeneratorMojo.java:90) > at > org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) > ... 21 more > [ERROR] > [ERROR] Re-run Maven using the -X switch to enable full debug logging. > [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 > $ > {noformat} > Failure happens in > {{org.objectweb.asm.FieldVisitor.visitTypeAnnotation(...)}} method: > {code} > if (api < Opcodes.ASM5) { > throw new RuntimeException(); > } > {code} > Simple fix is to pass {{Opcodes.ASM5}} (instead of {{Opcodes.-ASM4-}}) to > super constructors of > {{org.apache.maven.tools.plugin.extractor.annotations.scanner.visitors.MojoClassVisitor, > MojoFieldVisitor, and MojoAnnotationVisitor}} classes, e.g.: > {code} > MojoFieldVisitor( Logger logger, String fieldName, String className ) > { > super( Opcodes.ASM5 ); > this.logger = logger; > this.fieldName = fieldName; > this.className = className; > } > {code} > {{mvn integration-test}} passes on {{maven-plugin-tools-3.4}} with the change > applied to these three classes, and {{plugin:descriptor}} works flawlessly. -- This message was sent by Atlassian JIRA (v6.3.4#6332)