Skip to content

Using a Specific JAXB Version

highsource edited this page Oct 12, 2014 · 2 revisions

Using a specific version of JAXB 2.x specification

There are differences between JAXB 2.0, 2.1 and 2.2. By default, maven-jaxb2-plugin uses the latest available version of the latest available specification.

Do not forget to use the appropriate version of jaxb-impl.

If you need to stick to a specific version of the JAXB specification, there are two ways to accomplish this.

Configuring the JAXB specification version

You can specify the version of the JAXB specification using the following configuration option:

  • specVersion - Version of the JAXB specification (ex. 2.0, 2.1 or 2.2).

Using the version-specific plugin

Alternatively you may also use maven-jaxb20-plugin, maven-jaxb21-plugin or maven-jaxb22-plugin instead of maven-jaxb2-plugin to make your dependency on JAXB specification version more explicit:

<plugin>
	<groupId>org.jvnet.jaxb2.maven2</groupId>
	<artifactId>maven-jaxb20-plugin</artifactId>
	<executions>
		<execution>
			<goals>
				<goal>generate</goal>
			</goals>
		</execution>
	</executions>
</plugin>

All these plugins have identical configuration options (except that specVersion is ignored in maven-jaxb2X-plugins, it only makes sense in maven-jaxb2-plugin).

Clone this wiki locally