Thursday, 27 October 2011

JAXB Maven Plugin

It is used to generate Java classes from XML Schema (XSD). If you are using Maven, generating Java classes is very easy. Here is what you need to do: Add the following dependencies:

and then add the following under the build section in pom.xml:

Please note that -XtoString, -Xequals, -XhashCode etc are the arguments passed to the XJC compiler which override the toString(), equals() and hashCode() methods respectively of the generated classes. schemaDirectory : The location to your XSDs. generateDirectory : Generated code will be placed under this package.

No comments:

Post a Comment