Well, after long attempts, the following configuration worked for me. I am using jaxb2-maven-plugin 2.3.1 and a separate bind file:
pom.xml
<build> <pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> </plugins> </pluginManagement> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jaxb2-maven-plugin</artifactId> <version>2.3.1</version> <executions> <execution> <id>xjc</id> <phase>generate-sources</phase> <goals> <goal>xjc</goal> </goals> </execution> </executions> <configuration> <target>2.1</target> <sources> <source>src/main/xsd</source> </sources> <xjbSources> <xjbSource>src/main/xjb/bindings-1.3.xjb</xjbSource> </xjbSources> <arguments> <argument>-Xfluent-api</argument> </arguments> <outputDirectory>${basedir}/target/generated-sources/classes</outputDirectory> <clearOutputDir>false</clearOutputDir> <extension>true</extension> </configuration> <dependencies> <dependency> <groupId>org.jvnet.jaxb2_commons</groupId> <artifactId>jaxb2-fluent-api</artifactId> <version>3.0</version> </dependency> </dependencies> </plugin> </plugins> </build>
bindings.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jxb:bindings schemaLocation="../xsd/ccv1p3_imscp_v1p2_v1p0.xsd" node="//xs:schema"> <jxb:globalBindings> <jxb:serializable uid="1" /> <jxb:javaType name="java.util.Calendar" xmlType="xs:dateTime" parseMethod="javax.xml.bind.DatatypeConverter.parseDateTime" printMethod="javax.xml.bind.DatatypeConverter.printDateTime" /> </jxb:globalBindings> <jxb:schemaBindings> <jxb:package name="com.abc.xyz.generated.manifest" /> </jxb:schemaBindings> </jxb:bindings> <jxb:bindings schemaLocation="http://www.imsglobal.org/profile/cc/ccv1p3/LOM/ccv1p3_lommanifest_v1p0.xsd" node="//xs:schema"> <jxb:schemaBindings> <jxb:package name="com.abc.xyz.generated.lommanifest" /> </jxb:schemaBindings> </jxb:bindings> <jxb:bindings schemaLocation="http://www.imsglobal.org/profile/cc/ccv1p3/LOM/ccv1p3_lomresource_v1p0.xsd" node="//xs:schema"> <jxb:schemaBindings> <jxb:package name="com.lcs.thincc.generated.lomresource" /> </jxb:schemaBindings> </jxb:bindings>
Note that we do not need to specify packageName inside pom.xml , instead we can declare it using <jxb:schemaBindings> inside the bindings.xjb file , which is much simpler, as mentioned here .
agpt
source share