Skip to content
highsource edited this page Oct 21, 2014 · 7 revisions

Basic usage

Simply add the plugin with the generate execution goal to the 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>

In (very) old environments you may also need to set the maven-compiler-plugin to use at least 1.5 version for source and target:

<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.

The plugin has a large number of configuration options. Please see the plugin documentation or the cheat sheet for a complete reference.

Clone this wiki locally