Search code examples
maven-plugin

Upgrading to maven-plugin-plugin 3.6.4 results in com.thoughtworks.qdox.parser.ParseException: syntax error


After upgrading maven-plugin-plugin from 3.6.0 to 3.6.4, I am getting a the following exception while the build creates the maven-plugin-descriptor:

Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-descriptor of goal org.apache.maven.plugins:maven-plugin-plugin:3.6.4:descriptor failed: syntax error @[60,84] in file:/xyz/Foo.java
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:148)
...
Caused by: com.thoughtworks.qdox.parser.ParseException: syntax error @[60,84] in file:/xyz/Foo.java
        at com.thoughtworks.qdox.parser.impl.Parser.yyerror (Parser.java:1963)
        at com.thoughtworks.qdox.parser.impl.Parser.yyparse (Parser.java:2085)
        at com.thoughtworks.qdox.parser.impl.Parser.parse (Parser.java:1944)
        at com.thoughtworks.qdox.library.SourceLibrary.parse (SourceLibrary.java:232)

This is running with Maven 3.8.6.

The code compiles file - it's only when running through the org.apache.maven.plugins:maven-plugin-plugin:3.6.4:descriptor


Solution

  • Turns out this was related to using a restricted identifier (var, yield, record) as a method parameter. The underlying qdox parser seems to be more picky than the Java compiler in that regard.

    Running Sonarlint on the file helped identify the issue. They provide a nice description in their java:S6213 rule.