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)
Regards,
Christian
Am 05.10.2016 um 09:00 schrieb Richard Opalka:
Hi Christian,
the following snippet should work for you:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<!-- fork is needed so compiler args can be used -->
<fork>true</fork>
<compilerArgs>
<arg>-J--add-modules</arg>
<arg>-Jjava.xml.bind</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
Richard
On 10/05/2016 08:24 AM, Christian Beikov wrote:
So --add-modules didn't work, I still had the same exception. That's
because the annotation processor is trying to instantiate classes
from that module. When trying -J--add-modules it says: invalid flag:
-J--add-modules=java.xml.bind
Any ideas?
Regads,
Christian
Am 04.10.2016 um 21:39 schrieb Jonathan Gibbons:
If the annotation processor is trying to execute code in that
module, you may want -J--add-modules=java.xml.bind to add the module
to the javac runtime environment, as compared to the compilation
environment
-- Jon
On 10/4/16 11:48 AM, Stephen Felts wrote:
In JDK9, the java.xml.bind module is hidden by default.
You can normally turn it on by specifying --add-modules=java.xml.bind
-----Original Message-----
From: Christian Beikov [mailto:[email protected]]
Sent: Tuesday, October 04, 2016 2:22 PM
To: [email protected]
Subject: Maven annotation processing fails with JDK9-ea+138
Hello,
I have been trying out to build one of my Maven projects with JDK
9-ea+138 and it failed.
Specifically I got java.lang.NoClassDefFoundError:
javax/xml/bind/JAXBException during annotation processing.
I am using the org.bsc.maven:maven-processor-plugin:2.2.4 and the
annotation processor is the hibernate metamodel generator.
Is this a known issue or am I missing some configuration?
Regards,
Christian