Jakarta XML Schema is not present when updating to Java 17 and JAXB 3

3.7k views Asked by At

I'm currently updating our application to Java 17 and JAXB 3.

I switched to the jaxb30-maven-plugin for this

<groupId>com.evolvedbinary.maven.jvnet</groupId>
<artifactId>jaxb30-maven-plugin</artifactId>
<version>0.15.0</version>

Now I'm getting the error when I try to generate anything:

[WARNING] Error injecting: org.jvnet.mjiip.v_3_0.XJC30Mojo java.lang.TypeNotPresentException: Type jakarta.xml.bind.annotation.XmlSchema not present at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType

here is my pom.xml:

    <plugin>
        <groupId>com.evolvedbinary.maven.jvnet</groupId>
        <artifactId>jaxb30-maven-plugin</artifactId>
        <version>0.15.0</version>
        <configuration>
            <locale>en</locale>
            <extension>true</extension>
        </configuration>
        <executions>
            <execution>
                <id>Generate Import Sources</id>
                <goals>
                    <goal>generate</goal>
                </goals>
                <phase>generate-sources</phase>
                <configuration>
                    <schemaLanguage>XMLSCHEMA</schemaLanguage>
                    <schemaDirectory>${basedir}/src/main/resources/xsd</schemaDirectory>
                    <schemaIncludes>
                        <include>/Import_v1.xsd</include>
                    </schemaIncludes>
                    <generatePackage>com.company.project.v1</generatePackage>
                    <generateDirectory>${basedir}/target/jaxb</generateDirectory>
                    <bindingIncludes>
                        <bindingInclude>Import_v1.xjb</bindingInclude>
                    </bindingIncludes>
                </configuration>
            </execution>
        </executions>
        <dependencies>
            <dependency>
                <groupId>org.glassfish.jaxb</groupId>
                <artifactId>jaxb-runtime</artifactId>
                <version>2.3.3</version>
            </dependency>
            <dependency>
                <groupId>com.sun.activation</groupId>
                <artifactId>jakarta.activation</artifactId>
                <version>1.2.1</version>
            </dependency>
        </dependencies>

    </plugin>

Can you probably help me and see what the problem is?

0

There are 0 answers