Monday, 16 November 2009

Maven 2 Jaxb 2 Generated Serializable Classes

If using maven, place the bindings.xjb in src/main/xjb.

<jxb:bindings version="1.0"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema">

<jxb:globalBindings>
<jxb:serializable/>
</jxb:globalBindings>

</jxb:bindings>





Maven snippet:

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>xjc</goal>
</goals>
</execution>
</executions>
<configuration>
<packagename>my.package.name</packagename>
<outputdirectory>${basedir}/src/main/generated-source</outputdirectory>
<bindingFiles>bindings.xjb</bindingFiles>
</configuration>
</plugin>

No comments:

Links