Ok so adding MAVEN_OPTS="--add-modules=java.xml.bind" and also
specifying the same argument to the plugin seems to be a workaround for
now. For reference I opened an issue to allow forking:
https://github.com/bsorrentino/maven-annotation-plugin/issues/64
Regards,
Christian
Am 05.10.2016 um 09:29 schrieb Alan Bateman:
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@9-ea/Arguments.java:796)
at
com.sun.tools.javac.main.Arguments.doProcessArgs(jdk.compiler@9-ea/Arguments.java:393)
at
com.sun.tools.javac.main.Arguments.processArgs(jdk.compiler@9-ea/Arguments.java:303)
at
com.sun.tools.javac.main.Arguments.init(jdk.compiler@9-ea/Arguments.java:259)
at
com.sun.tools.javac.api.JavacTool.getTask(jdk.compiler@9-ea/JavacTool.java:179)
at
com.sun.tools.javac.api.JavacTool.getTask(jdk.compiler@9-ea/JavacTool.java:113)
at
com.sun.tools.javac.api.JavacTool.getTask(jdk.compiler@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