Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Groovy script to generate JAXB classes from an XSD
// Add the following to BuildConfig.groovy:
// build('com.sun.xml.bind:jaxb-xjc:2.1')
// build('com.sun.xml.bind:jaxb-impl:2.1')
target('generateSources': "Generate JAXB classes from a schema") {
def classpath = grailsSettings
.getBuildDependencies()
.join(System.getProperty("path.separator"))
Ant.taskdef(name: "xjc",
classname: "com.sun.tools.xjc.XJCTask",
classpath: classpath)
Ant.xjc(schema: "etc/schema/books.xsd",
destDir: "src/java",
'package': "com.microsoft.books")
}
@jschloer

This comment has been minimized.

Copy link

jschloer commented Aug 20, 2014

This was helpful. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.