The CXF XJC Maven Plugin

The CXF XJC Maven Plugin is a wrapper around the JAXB XJC tool to handle the XSD -> Java tasks.

There are two targets:

xsdtojava

Defaults into generate-sources phase and outputs to ${project.build.directory}/generated/src/main/java

xsdtojava-tests

Defaults into generate-test-sources phase and outputs to ${project.build.directory}/generated/src/test/java

Parameters

extensions

List of maven artifacts to add to the extension classpath. Each item in the list is a string of groupId:artifactId:version.

xsdOptions

List of XsdOption objects. See below.

sourceRoot/testSourceRoot

For the two targets above, override the default output directory.

The XsdOption object is used to pass specific options and configuration for each XSD file that is to be processed.

xsd

The location of the schema to process.

bindingFile

The location of the JAXB binding file to customize the output.

packagename

Specifies the package name to use for the outputted code.

extension

(boolean) Turns on the custom JAXB implementation extensions.

catalog

The location of a catalog file for mapping schema locations.

extensionArgs

List of additional arguements passed to XJC. (ex: -Xlocator)

dependencies

List of files that are examined to determine if subsequent runs of the plugin must re-generate code.

deleteDirs

List of directories that are removed after generation. If you have schemas that generate code that has already been generated, (possibly in a different maven module) you can specify this to have them removed. The preferred method to do this, however, is a binding file with the "skip" flag set on those namespaces.

Example: