Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare jaxb2-maven-plugin to run on JDK 11 #43

Closed
gunnarmorling opened this issue Jan 21, 2016 · 70 comments
Closed

Prepare jaxb2-maven-plugin to run on JDK 11 #43

gunnarmorling opened this issue Jan 21, 2016 · 70 comments

Comments

@gunnarmorling
Copy link

Hi, when running the jaxb2-maven-plugin on JDK 9 I am getting quite a handful of errors due to the usage of classes previously present in tools.jar and now not exposed any longer.

I could make it work by adding the following dependencies to my plugin configuration:

<dependency>
    <groupId>org.glassfish.jaxb</groupId>
    <artifactId>codemodel</artifactId>
    <version>2.2.11</version>
</dependency>
<dependency>
    <groupId>org.glassfish.jaxb</groupId>
    <artifactId>txw2</artifactId>
    <version>2.2.11</version>
</dependency>
<dependency>
    <groupId>com.sun.xsom</groupId>
    <artifactId>xsom</artifactId>
    <version>20140925</version>
</dependency>
<dependency>
    <groupId>com.sun.istack</groupId>
    <version>2.21</version>
    <artifactId>istack-commons-runtime</artifactId>
</dependency>
<dependency>
    <groupId>com.sun.xml.bind.external</groupId>
    <artifactId>rngom</artifactId>
    <version>2.2.11</version>
</dependency>

I think the plug-in could be changed to always use these dependencies instead of relying on JDK-internal classes. Unfortunately, the POMs of these dependencies resolve to a non-existing variable ${tools}, so a warning about the POMs being invalid will be issued by mvn, but JAXB seems to work fine with them.

@lennartj
Copy link
Member

At the moment, some plugins which we depend upon are not yet updated for Java9.

[ERROR] Failed to execute goal org.codehaus.mojo:cobertura-maven-plugin:2.7:clean (default) on project jaxb2-maven-plugin: Execution default of goal org.codehaus.mojo:cobertura-maven-plugin:2.7:clean failed: Plugin org.codehaus.mojo:cobertura-maven-plugin:2.7 or one of its dependencies could not be resolved: Could not find artifact com.sun:tools:jar:0 at specified path /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/../lib/tools.jar -> [Help 1]

@ge0ffrey
Copy link

We're seeing a similar issue for Drools, when running a build, that works on JDK 8, on JDK 9: https://issues.jboss.org/browse/DROOLS-1170

@lennartj
Copy link
Member

This is not an unimportant issue by any means.
In its present form, the plugin will not be able to run on JDK9.

However, I am tempted to defer starting fixing it until this autumn to give
other plugin developers the chance to make their plugins compliant with
JDK9 before integrating the JDK9 support into the jaxb2-maven-plugin.

@ge0ffrey
Copy link

@lennartj A lot of high profile projects are now in full throttle in testing against JDK 9, as part of the "JDK 9 quality outreach" program started a few months ago. Here's a list of those projects:
https://wiki.openjdk.java.net/display/quality/Quality+Outreach

That has been direct cause for us to start testing against JDK 9.
Download JDK 9 can be easily downloaded here: https://jdk9.java.net/download/

@lennartj lennartj self-assigned this May 26, 2016
@gunnarmorling
Copy link
Author

For now I'm not using the jaxb2-maven-plugin for my Java 9 experiments as I couldn't get it to work. For some reason it would ignore the JAXB binding file I need to use (and which always was applied when using the plug-in with JDK 8).

So I'm invoking xjc explicitly now with some Maven trickery. I'm going to share it here, maybe it's helpful to others:

<!-- Create target dir -->
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-antrun-plugin</artifactId>
    <version>1.4</version>
    <executions>
        <execution>
            <phase>generate-sources</phase>
            <configuration>
                <tasks>
                    <echo message="Creating target/generated-sources/jaxb"/>
                    <mkdir dir="./target/generated-sources/jaxb"/>
                </tasks>
            </configuration>
            <goals>
                <goal>run</goal>
            </goals>
        </execution>
    </executions>
</plugin>

<!-- Invoke xjc -->
<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <executions>
        <execution>
            <id>generate schema types</id>
            <phase>generate-sources</phase>
            <goals>
                <goal>exec</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <executable>xjc</executable>
        <arguments>
            <argument>-enableIntrospection</argument>
            <argument>-p</argument>
            <argument>org.hibernate.validator.internal.xml</argument>
            <argument>-extension</argument>
            <argument>-target</argument>
            <argument>2.1</argument>
            <argument>-d</argument>
            <argument>target/generated-sources/jaxb</argument>
            <argument>src/main/xsd/validation-configuration-1.1.xsd</argument>
            <argument>src/main/xsd/validation-mapping-1.1.xsd</argument>
            <argument>-b</argument>
            <argument>src/main/xjb/binding-customization.xjb</argument>
        </arguments>
    </configuration>
</plugin>

<!-- Add target dir to compilation -->
<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <executions>
        <execution>
            <id>add-source</id>
            <phase>generate-sources</phase>
            <goals>
                <goal>add-source</goal>
            </goals>
            <configuration>
                <sources>
                    <source>target/generated-sources/jaxb</source>
                </sources>
            </configuration>
        </execution>
    </executions>
</plugin>

@lennartj
Copy link
Member

I am quite aware of this; although we will include support for JDK9 within the plugin I will start with a much-needed release (2.3) handling enums, enhanced schema generation and various other fixes.

After that, we should approach 2 things:

  1. Supporting Java 9, and
  2. See if we can merge the codebases for the two JAXB plugins (i.e. this one and the one from java.net). While this latter task is certainly optional, I believe it would be good to have 1 "semi-normative" JAXB plugin rather than two which works in different ways. However, this is not only up to me and the rest of the MojoHaus folks, but also Alexei and the committers at java.net.

@lennartj
Copy link
Member

And also - Thanks @gunnarmorling for sharing the Exec-plugin recipe.

@lennartj
Copy link
Member

For the 2.4 version of the plugin (or perhaps we should move to 3.0 for this feature), we should support JDK 9.

@eolivelli
Copy link

I am getting this error with 2.3.1 version:

[ERROR] Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:2.3.1:xjc (xjc) on project magnews.uiapp.testcase: Execution xjc of goal org.codehaus.mojo:jaxb2-maven-plugin:2.3.1:xjc failed: A required class was missing while executing org.codehaus.mojo:jaxb2-maven-plugin:2.3.1:xjc: com/sun/codemodel/CodeWriter

Any plan to fix this issue ? is there a schedule for 2.4 ?
I will be glad to help if needed for me it is a showstopper for the migration to Java9

@lennartj
Copy link
Member

There are clear plans to fix it.
However, the tools.jar and JDK organisation to some extent is revamped in JDK 9.

... so this issue requires a tad more attention to detail than usual, to enable the plugin to run both on JDK8 and earlier and (using the same codebase) JDK9

@eolivelli
Copy link

thank you @lennartj for your quick reply.

I see your point, I will wait.
I will test the new version as soon the fix will be available

@gunnarmorling
Copy link
Author

enable the plugin to run both on JDK8 and earlier and (using the same codebase) JDK9

On that specific one, it may be a good idea to produce a multi-release JAR, allowing to have different versions of specific classes, each tied to one Java version. I've blogged about building MR JARs recently.

@Novanic
Copy link

Novanic commented May 7, 2017

The workaround with exec-maven-plugin is not working in my (current) environment, it throws: "A type incompatibility occurred while executing org.codehaus.mojo:exec-maven-plugin:1.6.0:exec: java.base/java.lang.String cannot be cast to org.codehaus.mojo.exec.Modulepath"... And jaxb2-maven-plugin is still not runnable with Java 9 (it uses classes which are moved to an internal package, so it is not even possible to just open the visibility...). You have 2,5 months at maximum to get this working. ;-)

Update: Ok, it is working when version 1.5 of the exec-maven-plugin instead of the newer version 1.6. And I had to set the -encoding parameter. And I had require the deprecated java.xml.bind module. Now the project is working with Java 9.

@rfscholte
Copy link
Member

https://stackoverflow.com/questions/46356092/jaxb2-maven-plugin-failing-on-java-9 is a good hint. For these java.se.ee modules we should find the matching dependency in Central. Most should be there, and it will also work with earlier java version(s).

@subes
Copy link

subes commented Oct 8, 2017

I fixed this issue by launching com.sun.tools.xjc.XJCFacade in a forked java process (because the facade calls System.exit -_-) inside my own plugin instead of continuing to scratch my head about why jaxb2-maven-plugin does not use .xjb schema bindings with java 9. At least this approach seems to be more robust regarding future java versions. Also this approach does not rely on the xjc executable being in the $PATH. I made this downwards compatible by using the approach from here to declare java version dependant dependencies. You can see the result here:

Maybe this helps in finding a solution for jaxb2-maven-plugin that is downwards compatible.

Also, if you get the error prefix '' is already bound to '', try disabling the episode file generation in xjc since it is turned on by default in jaxb2-maven-plugin as it seems.

@ghost
Copy link

ghost commented Nov 1, 2017

Is there progress in resolving this problem when using Java 9 ?

Execution xjc of goal org.codehaus.mojo:jaxb2-maven-plugin:2.3.1:xjc failed: A required class was missing while executing org.codehaus.mojo:jaxb2-maven-plugin:2.3.1:xjc: com/sun/codemodel/CodeWriter

@dlemmermann
Copy link

Any news on this?

@lennartj
Copy link
Member

Will start the development transition from the Maven2 compliant plugin to the Maven3 (and Java9) compliant plugin next week.

@lennartj
Copy link
Member

lennartj commented Dec 2, 2017

Currently, there are a few plugins and/or code quality dependencies which are not Java 9 compliant.

Among those are Cobertura and Checkstyle.
Will investigate if we can ensure plugin code quality without such plugins... or when they - in turn - expect to be Java 9 compliant.

@ptahchiev
Copy link

Java10 on the horizon, you guys still lack support for Java9 :(

@jvissers
Copy link

I'm also a bit worried about the fact that this plugin does not work for Java 9. The main problems seem to be related to schema bindings (#104) and the episode generation. These issues are seen in the other JAXB maven plugin also - which seems to suggest that both plugins are suffering from a similar fundamental issue introduced with Java 9. I'm thinking about keeping around a Java 8 build that produces the Java source files out of XSD's and then reuse these to have them compiled with Java 9. Its not pretty, but given the fact that XSD=>JAXB is a dead end/legacy path for us anyway, we might be able to get away with it.

Obviously I'd prefer if the maven plugin ecosystem would be fully Java 9 compliant - but apparently that is easier said then done.

@jvissers
Copy link

FYI: Found that http://cxf.apache.org/cxf-xjc-plugin.html (version 3.2.1) - does honor schemaBindings correctly. So these guys apparently have fixed the issue ~ which they also ran into.

@davidmoten
Copy link

davidmoten commented Jan 9, 2019

I've released xjc-maven-plugin to Maven Central and it's working well for me. I did use @subes' approach (fork a process and call XJCFacade) but also restricted the classpath (bindings files were sometimes ignored otherwise). Usage is documented on the project home page.

The plugin is unit tested on Oracle JDK 8, 9, 10, 11 and OpenJDK 10, 11 (using Travis).

Hope that's useful for others too while jaxb2-maven-plugin is getting sorted out.

@chrlembeck
Copy link

chrlembeck commented Jan 10, 2019

@davidmoten : Thanks a lot for your solution. It's working almost fine on my project generating sources from xsds. Unfortunately, the xjc plugin generates its output in windows default encoding rather than UTF-8. Is there any way do configure it to produce UTF-8?
The java 8 xjc documentation does not give any hint.

@subes
Copy link

subes commented Jan 10, 2019

@chrlembeck I think you can just change the system property file.encoding and xjc will pick it up:

https://stackoverflow.com/questions/361975/setting-the-default-java-character-encoding

Maybe you can do this inside your pom.xml with a simple property tag, otherwise a configuration option needs to be added to the plugin.

@chrlembeck
Copy link

@subes, @davidmoten: I tried both: Adding <file.encoding>UTF-8</file.encoding> into the properties section of the pom.xml and setting the system properties via mvn -Dfile.encoding=UTF-8 clean compile.
Unfortunately the was no effect and the generated source files can not be compiled because of its wrong encoding.

@subes
Copy link

subes commented Jan 10, 2019

Ok, it seems XJC has an option to set the encoding: https://docs.oracle.com/javase/9/tools/xjc.htm#JSWOR741

"-encoding encoding" This option specifies character encoding for generated source files.

So using a configuration option and passing this as the parameter should solve the issue. Or maybe just pass the file.encoding property value as the option.

@edwardxia
Copy link

I got the current version of this plugin working on JDK 8, 9, 10, 11 just by explicitly declaring all the necessary dependencies:

  <dependencies>
    <dependency>
      <groupId>org.glassfish.jaxb</groupId>
      <artifactId>jaxb-runtime</artifactId>
      <version>2.3.2</version>
    </dependency>
    <dependency>
      <groupId>com.sun.activation</groupId>
      <artifactId>jakarta.activation</artifactId>
      <version>1.2.1</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>jaxb2-maven-plugin</artifactId>
        <version>2.4</version>
        <executions>
          <execution>
            <id>xjc</id>
            <goals>
              <goal>xjc</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <packageName>......</packageName>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.glassfish.jaxb</groupId>
            <artifactId>jaxb-xjc</artifactId>
            <version>2.3.2</version>
          </dependency>
          <dependency>
            <groupId>com.sun.activation</groupId>
            <artifactId>jakarta.activation</artifactId>
            <version>1.2.1</version>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
  </build>

@RickDeckard76
Copy link

I got the current version of this plugin working on JDK 8, 9, 10, 11 just by explicitly declaring all the necessary dependencies:

  <dependencies>
    <dependency>
      <groupId>org.glassfish.jaxb</groupId>
      <artifactId>jaxb-runtime</artifactId>
      <version>2.3.2</version>
    </dependency>
    <dependency>
      <groupId>com.sun.activation</groupId>
      <artifactId>jakarta.activation</artifactId>
      <version>1.2.1</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>jaxb2-maven-plugin</artifactId>
        <version>2.4</version>
        <executions>
          <execution>
            <id>xjc</id>
            <goals>
              <goal>xjc</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <packageName>......</packageName>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.glassfish.jaxb</groupId>
            <artifactId>jaxb-xjc</artifactId>
            <version>2.3.2</version>
          </dependency>
          <dependency>
            <groupId>com.sun.activation</groupId>
            <artifactId>jakarta.activation</artifactId>
            <version>1.2.1</version>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
  </build>

Doesn't work for me.
Error is still:

"[ERROR] Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:2.4:xjc (XJC Build) on project test-backend: Prefix '' is already bound to '' -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:2.4:xjc (XJC Build) on project test-backend: Prefix '' is already bound to ''

@RickDeckard76
Copy link

RickDeckard76 commented Feb 11, 2019

Hi all, I got the solution thanks to the excellent work of @davidmoten .
For all that are in my same situation (switching to JDK11 having few few time): simply go to the github page of @davidmoten here https://github.com/davidmoten/jax-maven-plugin and use the plugin; it works without problems in my case.
Edit: I pasted the wrong link, above there is the correct link to the jax-maven-plugin

@davidmoten
Copy link

Glad to hear it's working @RickDeckard76, I've migrated the xjc-maven-plugin code to a more generic plugin jax-maven-plugin that supports xjc, wsimport, wsgen and schemagen goals. I believe Rick used jax-maven-plugin successfully and I've applied it to a number of uses across my company codebase with success. I'd like to pick up more test cases to cover the problems mentioned in this thread so feel free to mention them on issues at jax-maven-plugin. By the way jax-maven-plugin is deployed to Maven Central.

@sebastienvermeille
Copy link

I confirm that @edwardxia solution works for OpenJDK 10. (After 4 hours looking everywhere... I finally got it working on java 10.

Hope it will works for 11 when we migrate to 11 :/

@RickDeckard76
Copy link

RickDeckard76 commented Feb 12, 2019

I confirm that @edwardxia solution works for OpenJDK 10. (After 4 hours looking everywhere... I finally got it working on java 10.

Hope it will works for 11 when we migrate to 11 :/

I confirm, it works on JDK11 (I used openJDK11 and AdoptOpenJDK11)

@k-tomaszewski
Copy link

k-tomaszewski commented Feb 27, 2019

For me the solution provided by @edwardxia didn't work without adding a special workaround - I needed to add an extra, dummy XSD file to my project to get rid of the error:
[ERROR] Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:2.4:xjc (xjc) on project test-project: Prefix '' is already bound to ''

I've described the full solution here: https://artofcode.wordpress.com/2019/02/26/jaxb2-maven-plugin-2-4-and-java-11/

This workaround was verified for OpenJDK 11 .

veithen added a commit to veithen/jaxb2-maven-plugin that referenced this issue Mar 24, 2019
Also move Xalan to the runtime dependencies: some integration tests
appear to be sensitive to subtle differences in the transformer output
between Java versions.
veithen added a commit to veithen/jaxb2-maven-plugin that referenced this issue Mar 24, 2019
Also move Xalan to the runtime dependencies: some integration tests
appear to be sensitive to subtle differences in the transformer output
between Java versions.

Finally, add Java >= 9 to the Travis config to prevent regression.
veithen added a commit to veithen/jaxb2-maven-plugin that referenced this issue Mar 24, 2019
Also move Xalan to the runtime dependencies: some integration tests
appear to be sensitive to subtle differences in the transformer output
between Java versions.

Finally, add Java >= 9 to the Travis config to prevent regression.
veithen added a commit to veithen/jaxb2-maven-plugin that referenced this issue Mar 24, 2019
Also move Xalan to the runtime dependencies: some integration tests
appear to be sensitive to subtle differences in the transformer output
between Java versions.

Finally, add Java 9 and 10 to the Travis config to prevent regression.
Java 11 will require an additional fix.
lennartj pushed a commit that referenced this issue Mar 25, 2019
Also move Xalan to the runtime dependencies: some integration tests
appear to be sensitive to subtle differences in the transformer output
between Java versions.

Finally, add Java 9 and 10 to the Travis config to prevent regression.
Java 11 will require an additional fix.
veithen added a commit to veithen/jaxb2-maven-plugin that referenced this issue Mar 25, 2019
- Upgrade the JAXB implementation to 2.3.2.
- Remove the profiles that were used to work around Java compatibility
issues in previous JAXB versions.
- Remove some direct dependencies and instead rely on transitive
dependencies from JAXB (so that we don't need to adjust them when
upgrading to a new JAXB version).
- Update the integration tests to add the relevant dependencies for APIs
that were removed from the JRE in Java 11.

Fixes mojohaus#43.
@charegre
Copy link

I got the current version of this plugin working on JDK 8, 9, 10, 11 just by explicitly declaring all the necessary dependencies:

  <dependencies>
    <dependency>
      <groupId>org.glassfish.jaxb</groupId>
      <artifactId>jaxb-runtime</artifactId>
      <version>2.3.2</version>
    </dependency>
    <dependency>
      <groupId>com.sun.activation</groupId>
      <artifactId>jakarta.activation</artifactId>
      <version>1.2.1</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>jaxb2-maven-plugin</artifactId>
        <version>2.4</version>
        <executions>
          <execution>
            <id>xjc</id>
            <goals>
              <goal>xjc</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <packageName>......</packageName>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.glassfish.jaxb</groupId>
            <artifactId>jaxb-xjc</artifactId>
            <version>2.3.2</version>
          </dependency>
          <dependency>
            <groupId>com.sun.activation</groupId>
            <artifactId>jakarta.activation</artifactId>
            <version>1.2.1</version>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
  </build>

Hi,

I am using OpenJDK 11.0.2 and I tried your approach but I am getting the following error:

org.xml.sax.SAXParseException: External parsing is disabled. Cannot parse URI: file:/Path_to_my/my.dtd
at com.sun.xml.dtdparser.InputEntity.fatal (InputEntity.java:971)
at com.sun.xml.dtdparser.InputEntity.init (InputEntity.java:140)
at com.sun.xml.dtdparser.DTDParser.parseInternal (DTDParser.java:288)
...
...
[ERROR] Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:2.4:xjc (xjc) on project my-project:
[ERROR] +=================== [XJC Error]
[ERROR] |
[ERROR] | 0: file:/Path_to_my/my.dtd
[ERROR] |
[ERROR] +=================== [End XJC Error]

I checked the permissions of my.dtd, and it should be able to read it, I even changed them to all read, write and execute.

It still fails, any suggestions for OpenJDK 11 ?

@lennartj
Copy link
Member

lennartj commented Jul 7, 2019

Updated all JAXB-API dependencies to the Jakarta artifacts (see #138), and got the full suite of IT tests to build on JDK 11 as well.

However, it implies that one adds the dependency below (since the javax.xml.bind is not in the JDK any longer):

<dependency>
  <groupId>jakarta.xml.bind</groupId>
  <artifactId>jakarta.xml.bind-api</artifactId>
  <version>2.3.2</version>
</dependency>

@shavo007
Copy link

shavo007 commented Sep 4, 2020

@edwardxia magic mate! such a minefield to get this plugin working with java 11. i just wanted to use schema gen...

@DhruvAShah
Copy link

DhruvAShah commented Oct 5, 2022

Hi ,
I was getting similar compilation errors while building maven with Java 17 and maven-jaxb2 plugin 2.3.0 . I tried latest version as well but got Mojo Exception while building the same with Maven . After researching a bit I was able to fix the issue using below implementation for jaxb2-plugin ,

Java - 17
Jaxb2-maven-plugin - 0.14.0
Spring Boot Maven - 2.7.4

In properties Tag add below version ,
<maven-jaxb2-plugin.version>0.14.0</maven-jaxb2-plugin.version>

In Build Tag ,

<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>${maven-jaxb2-plugin.version}</version>
<executions>
	<execution>
		<id>example-xmls</id>
		<goals>
			<goal>generate</goal>
		</goals>
		<configuration>
			<generateDirectory>${project.basedir}/src/main/java/com/cumulocity/exchnage_Demo</generateDirectory>
			<schemaDirectory>${project.basedir}/src/main/resources/</schemaDirectory>
			<schemaIncludes>
				<include>**/*.xsd</include>
			</schemaIncludes>
			<bindingDirectory>${project.basedir}/src/main/resources/</bindingDirectory>
			<bindingIncludes>
				<include>**/*.xjb</include>
			</bindingIncludes>
		</configuration>
	</execution>
</executions>
<dependencies>
	<dependency>
		<groupId>org.glassfish.jaxb</groupId>
		<artifactId>jaxb-runtime</artifactId>
		<version>2.3.3</version>
	</dependency>
</dependencies>
</plugin>	

After this JAXB-2 Implementation was successfully generated . Make sure to add below dependency as well helpful to provide implementation during runtime (When we run the main class)

<dependency>
         <groupId>org.glassfish.jaxb</groupId>
         <artifactId>jaxb-runtime</artifactId>
         <version>2.3.3</version><!--$NO-MVN-MAN-VER$-->
         <scope>runtime</scope>
    </dependency>

This should work for all those struggling with Java 17 and spring boot version 2.7.4+ with jabxb2 maven plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.