Maven annotation processing fails with JDK9-ea+138

Alan Bateman Alan.Bateman at oracle.com
Wed Oct 5 07:29:02 UTC 2016


On 05/10/2016 08:04, Christian Beikov wrote:

> Thanks, but I am using the maven-processor-plugin. Nevertheless, I 
> added the flags to the plugin since it also allows to add compiler 
> arguments, but I get this exception:
>
> java.lang.IllegalArgumentException: invalid flag: -J--add-modules
>         at 
> com.sun.tools.javac.main.Arguments.error(jdk.compiler at 9-ea/Arguments.java:796)
>         at 
> com.sun.tools.javac.main.Arguments.doProcessArgs(jdk.compiler at 9-ea/Arguments.java:393)
>         at 
> com.sun.tools.javac.main.Arguments.processArgs(jdk.compiler at 9-ea/Arguments.java:303)
>         at 
> com.sun.tools.javac.main.Arguments.init(jdk.compiler at 9-ea/Arguments.java:259)
>         at 
> com.sun.tools.javac.api.JavacTool.getTask(jdk.compiler at 9-ea/JavacTool.java:179)
>         at 
> com.sun.tools.javac.api.JavacTool.getTask(jdk.compiler at 9-ea/JavacTool.java:113)
>         at 
> com.sun.tools.javac.api.JavacTool.getTask(jdk.compiler at 9-ea/JavacTool.java:68)
>         at 
> org.bsc.maven.plugin.processor.AbstractAnnotationProcessorMojo.executeWithExceptionsHandled(AbstractAnnotationProcessorMojo.java:527)
>         at 
> org.bsc.maven.plugin.processor.AbstractAnnotationProcessorMojo.execute(AbstractAnnotationProcessorMojo.java:285)
Ah, this is a Maven plugin invoking the compiler via the API, not the 
javac launcher. In that case, then -J won't be understood as -J is for 
launchers/tools to pass options through to the runtime environment 
(nothing new here, -J has always been the way to do this).

Can the maven-processor-plugin be configured to run in its own VM, as in 
<fork>true</fork> like Richard suggested for the compiler plugin?

-Alan




More information about the jigsaw-dev mailing list