I have been trying to upgrade my JHipster 5 application to use Java 10 but I can't get it to compile and process JPA static metamodels with Maven.
Apparently maven-compiler-plugin
is not triggering hibernate-jpamodelgen
in order to generate the JPA static metamodels.
In order to upgrade the project I have:
- installed Oracle´s JDK 10.0.1
- switched my pom.xml to
<java.version>10</java.version>
upgraded maven-compiler-plugin to add
java.xml.bind
module (since it is not included by default as of Java 10) as follows:<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>${maven-compiler-plugin.version}</version> <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> <annotationProcessorPaths> <path> <groupId>org.mapstruct</groupId> <artifactId>mapstruct-processor</artifactId> <version>${mapstruct.version}</version> </path> <!-- For JPA static metamodel generation --> <path> <groupId>org.hibernate</groupId> <artifactId>hibernate-jpamodelgen</artifactId> <version>${hibernate.version}</version> </path> </annotationProcessorPaths> </configuration> </plugin>
With this I am getting compilation failure when I run ./mvnw clean compile
with no further detailed error message.
If I remove the <compilerArgs>
tag from pom.xml and run the same command I get: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
I have followed the upgrade instructions provided here
Also, I made this example project available on GitHub
This is the commit changes where I upgraded to Java 10