5

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 ...)

Ed Staub
  • 15,480
  • 3
  • 61
  • 91

1 Answers1

3

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:

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:

johan
  • 518
  • 6
  • 18
bdoughan
  • 147,609
  • 23
  • 300
  • 400
  • I need to run the MOXy version of XJC, don't I -especially if using eclipselink-oxm.xml files? So where would the jaxb.properties file and oxm files go in this context? I thought that ormally it goes in the package being created, and that normally xjc is creating it, not reading it. – Ed Staub May 19 '11 at 16:13
  • @Ed Staub - MOXy uses the XJC component from the reference implementation. Since the generated files are standard, it doesn't matter which implementation you use to generate them. When you run the MOXy scripts jaxb-compiler.sh we have a small wrapper class that produces the jaxb.properties file in the appropriate spot. You are correct, the jaxb.properties file needs to go in the package being created. We currently don't support generating the eclipselink-oxm.xml files from XJC, currently this file is used as alternative to annotations when starting from Java classes. – bdoughan May 19 '11 at 16:28
  • @Ed Staub - For info on using eclipselink-oxm.xml see: http://bdoughan.blogspot.com/2010/12/extending-jaxb-representing-annotations.html – bdoughan May 19 '11 at 16:28
  • http://jaxb.java.net/jaxb-maven2-plugin/ this is not the codehaus plugin, since this is not oracle code base, my employer says its not standard and we cant use this – Kalpesh Soni Jun 02 '15 at 16:40