Thursday, June 12, 2014

Generating JAXB artifacts from XSD/WSDL through Maven

Generating JAXB artifacts from XSD/WSDL through Maven

The maven-jaxb2-plugin can be used to generate the java classes from both XSD/WSDL.

Plugin configuration in Pom.xml

The below plug in configuration can be used in the pom.xml file to generate the sources.

Change the include accordingly to generate for wsdl -   <include>*.wsdl</include>

Generate the sources

To generate the sources, Right click on pom.xml-->Run As-->Maven generate-sources

This will generate all the java classes to src/main/java


  1. generate
    [ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format

  2. Run As -> Maven generate-sources wasn't working for me. Instead I opened command prompt. Navigated to project folder and used: mvn jaxb2:generate. Then refresh project in eclipse.