How to generate Java from an XSD using MOXy under

2019-06-26 07:51发布

问题:

What's the easiest/best way to generate Java from an XSD using MOXy under Maven-3? The reference JAXB interface has a nice Maven plugin, but it doesn't appear to support MOXy.

Does anyone have anything concrete to offer? (I know I can write ant-script, or a plugin, or ...)

回答1:

EclipseLink MOXy, does not yet offer a Maven plugin to run the XML schema to Java compiler. I have entered the following enhancement request to track this functionality:

  • https://bugs.eclipse.org/346486

MOXy leverages the XJC component from the reference implementation, so you could access that Maven plug-in and add then add the jaxb.properties file specifying MOXy as the JAXB provider:

  • http://jaxb.java.net/jaxb-maven2-plugin/
  • http://bdoughan.blogspot.com/2011/05/specifying-eclipselink-moxy-as-your.html