axis2-xsd2java-maven-plugin offers two goals: generate-sources
and generate-test-sources
. Both read one or more XSD files and generate the corresponding ADB beans, but they differ in the phases in which they expect to be executed. Use generate-sources
if the generated classes should become part of the artifact produced by the Maven module; use generate-test-sources
if the generated code is only used by the unit tests.
To run the plugin, add the following section to your POM:
<build> <plugins> <plugin> <groupId>org.apache.axis2.maven2</groupId> <artifactId>axis2-xsd2java-maven-plugin</artifactId> <executions> <execution> <goals> <goal>generate-sources</goal> </goals> </execution> <configuration> <xsdFiles> <xsdFile>src/main/resources/xsd/attribute.xsd</xsdFile> </xsdFiles> <namespaceMappings> <namespaceMapping> <uri>http://www.example.org/schema/test</uri> <packageName>org.example.schema.test</packageName> </namespaceMapping> </namespaceMappings> </configuration> </executions> </plugin> </plugins> </build>
The plugin will be invoked automatically in the generate-sources phase.
It reads the specified XSD files and creates the matching Axis2 ADB Java bean classes. The mapping from XSD target-namespaces to Java packages is specified with the namespaceMappings
configuration element above.
See the detailed documentation on properties for how to configure the goal.