jaxb – generate java class from xsd without xjc [closed]

I need some help, I’m trying to unmarshall XML for my application. So I have an XSD file, and I want to generate Java classes from it. But I don’t want to use XJC command (because it’s not in my JDK and also I want it to be done automatically every time I run my code).

Does someone have another option with JAXB without using xjc please?

I’m working with Java (jdk : 12 & jre : 8) and IntelliJ community.

update : the indicated plugin in pom file wasn’t working “couldn’t find artifact..”


It really depends on how your project is organized / build. If you want to generate java classes to be built on base of XSD files each time when project is build (which makes sense, because XSD files could be changed due to new requirements or new service version), you probably should use build manager (maven or gradle) and an appropriate maven / gradle plugin, which will be invoked during project build.

For this purpose maven-jaxb2-plugin could be used, which uses XJC under the hood as well, but when using maven or gradle you shouldn’t worry about having or not having the XJC in your system – it will be downloaded by project build manager as well as all other dependencies defined.


Here is an example of plugin configuration:



        <!-- Generate JAXB classes -->
                <!-- Handle XML schema -->