How to run XJC with Java 11 and maven?

10,005

I've just investigated the same topic. The best way for Java 11 is to use cxf-xjc-plugin. It's a Maven plugin. No other Maven plugin is able to work under Java 11 without annoying workarounds.

I've published a complete example with cxf-xjc-plugin here: https://artofcode.wordpress.com/2019/02/28/generating-classes-from-xsd-under-java-11-the-right-way/

Share:
10,005
Walter Kuhn
Author by

Walter Kuhn

Started in IT (first program written in 1980), studied computer sciences and having a PhD in it, worked in it, went to management, later to education, and went back to IT after a decade. Architecting solutions, developing with Java, XML. (Learned and forgot Basic, Pascal, C, C++, Fortran, Ada, Occam, ML, M68K, I86, 6502, Mathematica, LabView,..) Beside IT, like music (classical as well as rock), plays piano from time to time. Native speaker of German.

Updated on June 04, 2022

Comments

  • Walter Kuhn
    Walter Kuhn almost 2 years

    To generate java classes from XSD (for reading XML files), we used jaxb2-maven-plugin and Java8.

    For java 11, we get many issues...

    What libraries and plugins do work (today), allowing to generate java code from XSD using java 11 and maven? If possible point out different solutions, such as with cxf-xjc-plugin, jaxb2-Maven-Plugin and others.

  • Walter Kuhn
    Walter Kuhn about 5 years
    could you copy your solution here? would be perfect for others to find it.
  • OldCurmudgeon
    OldCurmudgeon almost 5 years
    I'd second that - I spent nearly two days trying to get the jaxb2 plugins to work. When I finally decided to change to CXF it took me about 1/2 hour and everything was working!!!