I am trying to migrate my Java class generation from the former javax.* to jakarta.* I am using the Maven Plugin

<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>3.1.0</version>

setting the target to 3.0 and using the args

<arguments>
    <argument>-Xinject-code</argument>
    <argument>-Xannotate</argument>
</arguments>

In my xjb I have some annotate bindings (to add Lombok annotations to my classes).

<jxb:bindings version="3.0"
    xmlns:jxb="https://jakarta.ee/xml/ns/jaxb"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
    xmlns:annox="http://annox.dev.java.net"
    jxb:extensionBindingPrefixes="xjc annox">

I get the exception: "com.sun.tools.xjc.BadCommandLineException: unrecognized parameter -Xannotate"

I get, that annotate is a xjc plugin. Is there a new implementation of it, that i can add to the jaxb2-maven-plugin dependencies to make this work?

I already tried

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>jaxb2-maven-plugin</artifactId>
    <version>3.1.0</version>
    ...
    <dependencies>
        <dependency>
            <groupId>org.patrodyne.jvnet</groupId>
            <artifactId>hisrc-hyperjaxb-annox-plugin</artifactId>
            <version>2.1.1</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>${lombok.version}</version>
        </dependency>
    </dependencies>
</plugin>

Without success (still unrecognized parameter)

1

There are 1 best solutions below

0
Laurent Schoelens On

The http://annox.dev.java.net namespace is related to the jaxb2 annotate plugin

Now the plugin has been merged into jaxb-tools which was former repository of maven-jaxb2-plugin.

You can follow the migration guide to get the latest version of the plugin. Starting from v3 (jakarta jaxb3 version), the plugin is located under

<groupId>org.jvnet.jaxb</groupId>
<artifactId>jaxb-plugin-annotate</artifactId>
<version>[3.0.0 / 4.0.0]</version>

Starting from v3, the old http://annox.dev.java.net namespace was renamed to urn:jaxb.jvnet.org:annox with partial backward support (old namespace is still supported where possible but users are encouraged to move to the new one).

Related Questions in JAKARTA-MIGRATION