Apache Maven 1.x has reached its end of life, and is no longer supported. For more information, see the announcement. Users are encouraged to migrate to the current version of Apache Maven.


This document describes the tags that are available when using the Castor Plug-in with Maven.

Please refer to the Integration document for more information on how to integrate these tags into your project.


castor:generate Generate java sources from an XML Schema.
castor:srcgen DEPRECATED. Use castor:generate instead


The castor:generate target generates java sources from an XML Schema (XSD file).

Sources are generated in the ${maven.castor.dest} directory.

Sources are only generated if the input schema is newer than any existing generated source.

Attribute NameDescriptionOptional?
schema The path to the XML schema No
package The package for the generated source Yes
types Sets which type factory to use. This is useful if you want JDK 1.2 collections instead of JDK 1.1, or if you want to pass in your own FieldInfoFactory.

If not specified, java.util.Vector will be used for collections.

See Collection Types for valid values.
marshal If 'false', disables generation of the marshalling framework methods (marshal, unmarshal, validate).

Defaults to 'true'.