Using the JAXB2 Simplify Plugin together with Java 17 and jaxb2-maven-plugin of codehaus

4.4k views Asked by At

Starting of with a project that has jaxb2-maven-plugin and the Highsource jaxb2-basics plugin for the Maven-plugin jaxb2-maven-plugin I was able to use the Highsource "JAXB2 Simplify Plugin".

But this was while the project was still using the old jaxb2-maven-plugin (2.4 version) and Java 8 targeting JAXB 2.2.

Now I would like to use the same "JAXB2 Simplify Plugin" in Java 17 and the jaxb2-maven-plugin:3.1.0 (targeting JAXB 3.0) but now we get a Class javax.xml.bind.JAXBException as you could imagine as presumable the "JAXB2 Simplify Plugin" (2.0.9) does not support the new Jakarta namespace.

Question: what is the new groupId:artifactId for the "JAXB2 Simplify Plugin" for when I do the Java 17/JAXB 3.0. Or would I need to switch to a different xjc wrapper.

(As a reference: I'm also using the "JAXB2 Namespace Prefix Plugin" which does seem to work, maybe it does not need the javax/jakarta namespace? I also use the Maven-plugin-plugin jaxb-lombok-plugin by yobibit.)

1

There are 1 answers

2
Laurent Schoelens On BEST ANSWER

You can follow the migration guide to follow up upgrade to v3 / v4 with jakarta support.

I think you have to change artifact jaxb2-basics to the following

<groupId>org.jvnet.jaxb</groupId>
<artifactId>jaxb-plugins</artifactId>

V3 version targets jaxb 3 api and jdk8 baseline

V4 version targets jaxb 4 api and jdk11 baseline