[ https://issues.apache.org/jira/browse/MNG-6930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17127698#comment-17127698 ]
Abel Salgado Romero commented on MNG-6930: ------------------------------------------ Forgot to come back, I got confused with some other errors and just today saw the problem was in `plexus-component-metadata`, v1.7 already fixed this. If I want to keep my plugin Java8 compatible are the latest versions safe? > Cannot use lambda as argument in a method in Mojo > ------------------------------------------------- > > Key: MNG-6930 > URL: https://issues.apache.org/jira/browse/MNG-6930 > Project: Maven > Issue Type: Bug > Components: Plugin API > Affects Versions: 3.6.0 > Reporter: Abel Salgado Romero > Priority: Major > > I have a plugin with uses a component that receives a lambda as argument. > When passing any lamba, for example the following empty one > > {code:java} > > Optional<File> sourceDir = new SourceDirectoryLocator(sourceDirectory, > project.getBasedir(), file -> {}) > .find(); > {code} > > `maven-plugin-plugin` fails with the error: > > {code:java} > > [ERROR] Failed to execute goal > org.codehaus.plexus:plexus-component-metadata:1.5.5:generate-metadata > (default) on project asciidoctor-maven-plugin: Error generating metadata: : > Failed to extract descriptors: Index 9578 out of bounds for length 999 -> > [Help 1] > org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute > goal org.codehaus.plexus:plexus-component-metadata:1.5.5:generate-metadata > (default) on project asciidoctor-maven-plugin: Error generating metadata: > at org.apache.maven.lifecycle.internal.MojoExecutor.execute > (MojoExecutor.java:215) > > {code} > > > Passing `null` or an anonymous class like shown below works however. > > {code:java} > > Optional<File> sourceDir = new SourceDirectoryLocator(sourceDirectory, > project.getBasedir(), > new Consumer<File>() { > @Override > public void accept(File file) { > getLog().info("sourceDirectory " + file + " does not exist"); > } > }) > .find(); > > {code} > > > Also tested with the current SNAPSHOT and the issue still happens > Here is the code to reprodude: > [https://github.com/abelsromero/asciidoctor-maven-plugin/tree/maven-plugin-plugin-lambda-issue] > . Just run `mvn clean test-compile` to see the error. -- This message was sent by Atlassian Jira (v8.3.4#803005)