Examples

Maven

Maven users simply add the CC-XJC plugin as a dependency to a JAXB plugin of choice. The following example demonstrates the use of the CC-XJC plugin with the Mojo jaxb30-maven-plugin

<plugin>
  <groupId>com.evolvedbinary.maven.jvnet</groupId>
  <artifactId>jaxb30-maven-plugin</artifactId>
  <version>0.15.0</version>
  <dependencies>
    <dependency>
      <groupId>de.wcht.cc-xjc</groupId>
      <artifactId>cc-xjc-plugin</artifactId>
      <version>3.0.1</version>
    </dependency>
  </dependencies>
  <executions>
    <execution>
      <id>xjc</id>
      <goals>
        <goal>generate</goal>
      </goals>
      <configuration>
        <args>
          <arg>-copy-constructor</arg>
        </args>
        <schemaDirectory>src/main/schemas</schemaDirectory>
        <bindingDirectory>src/main/jaxb</bindingDirectory>
        <extension>true</extension>
      </configuration>
    </execution>
  </executions>
</plugin>

JAXB-RI CLI

To use the JAXB-RI XJC command line interface simply add the corresponding java archives to the classpath and execute the XJC main class 'com.sun.tools.xjc.Driver'. The following example demonstrates a working command line for use with JDK 1.5 (assuming the needed dependencies are found in the current working directory).

  java -cp activation-1.1.jar:\
           jaxb-api-2.0.jar:\
           stax-api-1.0.jar:\
           jaxb-impl-2.0.5.jar:\
           jaxb-xjc-2.0.5.jar:\
           cc-xjc-plugin-2.0.jar\
           com.sun.tools.xjc.Driver -d /tmp/src -copy-constructor <schema files>