duke

Maven 2 JAXB 2.x Plugin

This Maven 2 plugin wraps the JAXB 2.x XJC compiler and provides the capability to generate java sources from schemas.

Quickstart

  1. Put your schemas (*.xsd) and bindings (*.xjb) into the src/main/resources folder.

  2. Add the plugin to your build:

    <build>
    	<plugins>
    		<plugin>
    			<groupId>org.jvnet.jaxb2.maven2</groupId>
    			<artifactId>maven-jaxb2-plugin</artifactId>
    			<executions>
    				<execution>
    					<goals>
    						<goal>generate</goal>
    					</goals>
    				</execution>
    			</executions>
    		</plugin>
    	</plugins>
    </build>
  3. Reconfigure the compiler plugin to use 1.5:

    <build>
    	<plugins>
    		...
    		<plugin>
    			<inherited>true</inherited>
    			<groupId>org.apache.maven.plugins</groupId>
    			<artifactId>maven-compiler-plugin</artifactId>
    			<configuration>
    				<source>1.5</source>
    				<target>1.5</target>
    			</configuration>
    		</plugin>
    	</plugins>
    </build>

See the sample purchase order project for example.

Project Homepage

Maven JAXB2 Plugin project homepage was moved to the following address:

http://confluence.highsource.org/display/MJIIP/Maven+JAXB2+Plugin

Documentation

Maven JAXB2 Plugin documentation can be found here:

http://confluence.highsource.org/display/MJIIP/Documentation

Here's a couple of direct links: