Generating hashCode() and equals() when creating Java classes using Mojo Jaxb2 maven plugin

JAXB2 Basics you’re mentioning is not a property of maven-jaxb2-plugin, it is a standalone set of JAXB 2.x plugins you can use with XJC – or jaxb2-maven-plugin or whatever. <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jaxb2-maven-plugin</artifactId> <version>1.3.1</version> <executions> <execution> <id>xjc</id> <goals> <goal>xjc</goal> </goals> </execution> </executions> <configuration> <arguments> <argument>-Xequals</argument> <argument>-XhashCode</argument> </arguments> </configuration> <dependencies> <dependency> <groupId>org.jvnet.jaxb2_commons</groupId> <artifactId>jaxb2-basics</artifactId> <version>0.12.0</version> </dependency> </dependencies> </plugin> … Read more

Generating a JAXB class that implements an interface

Unfortunately, it looks like the interface-injection plugin mentioned in some of the other answers is no longer well-supported. In fact, I’m having trouble finding the JAR for download. Thankfully, the JAXB2 Basics Plugins provides a similar mechanism for adding an interface to the generated JAXB stubs (see the Inheritance plugin). The Inheritance plugin documentation has … Read more