Skip to content
Laurent Schoelens edited this page Nov 13, 2023 · 6 revisions

Using JAXB plugins

  • plugins/plugin - Configures artifacts of the custom JAXB plugins you want to use.
  • args/arg - A list of extra XJC's command-line arguments (items must include the dash "-"). Use this argument to enable the JAXB plugin you want to use.

Example for JAXB 2 :

Artifact name is org.jvnet.jaxb:jaxb2-basics for JAXB2 version, so here's an example for JAXB2 based plugin version

<configuration>
	<extension>true</extension>
	<args>
		<arg>-XtoString</arg>
		<arg>-Xequals</arg>
		<arg>-XhashCode</arg>
		<arg>-Xcopyable</arg>
	</args>
	<plugins>
		<plugin>
			<groupId>org.jvnet.jaxb</groupId>
			<artifactId>jaxb2-basics</artifactId>
			<version><!-- use same version as jaxb-maven-plugin --></version>
		</plugin>
	</plugins>
</configuration>

Example for JAXB 3+ :

Artifact name is org.jvnet.jaxb:jaxb-plugins for JAXB 3+ (jakarta namespace) version, so here's an example for JAXB 3+ based plugin version

<configuration>
	<extension>true</extension>
	<args>
		<arg>-XtoString</arg>
		<arg>-Xequals</arg>
		<arg>-XhashCode</arg>
		<arg>-Xcopyable</arg>
	</args>
	<plugins>
		<plugin>
			<groupId>org.jvnet.jaxb</groupId>
			<artifactId>jaxb-plugins</artifactId>
			<version><!-- use same version as jaxb-maven-plugin --></version>
		</plugin>
	</plugins>
</configuration>

See the sample JAXB plugins project for example.

Logging with SLF4J

If your JAXB plugin is using the SLF4J logging facade, log messages will be handled by the SLF4J binding from the Maven installation.

Clone this wiki locally