Mar 29, 2015
Mar 22, 2022
Jan Ouwens (jqno)
Michael Keppler (Bananeweizen)
Jan Ouwens (jqno)
Thomas Matthijs (selckin)
Andrey Turbanov (turbanoff)
Simon Legner (simon04)
Michal Kordas (mkordas)
Stephan Schroevers (Stephan202)
Vincent Privat (don-vip)
Patrick Strawderman (kilink)
Roman Ivanov (romani)
Karl Heinz Marbaise (khmarbaise)
Nathan Perdijk (NRBPerdijk)
Evan Gilbert (eggilbert)
Matt M. (9numbernine9)
Show all (30)30
Source code

Show card


EqualsVerifier can be used in Java unit tests to verify whether the contract for the equals and hashCode methods in a class is met. The Maven coordinates are:


Note that there's also a 'fat' jar with no transitive dependencies with artifactId equalsverifier-nodep.


Please see the project's website.


Pull requests are welcome! If you plan to open one, please also register an issue or send a message to the Google Group, so we can discuss it first. It would be a shame to put in a lot of work on something that isn't a good fit for the project. Also, I can help you by giving pointers on where to find certain things.



To build EqualsVerifier, you need Maven. Just call mvn from the command-line, without any parameters, and you're done. Alternatively, you can use any IDE with Maven support.

There are several Maven profiles that can be enabled or disabled:

profile activation purpose
modules-jdk8 JDK 8 up to but not including 11 Build only the modules that are compatible with Java 8 and up.
modules-jdk11 JDK 11 up to but not including 16 Build only the modules that are compatible with Java 11 and up.
modules-jdk16 JDK 16 Build only the modules that are compatible with Java 16 and up.
modules-jdk17 JDK 17 and up Build all modules and build releaseable artifacts.
static-analysis JDK 17 and up, and disableStaticAnalysis property must be off Run static analysis checks. This only happens on a recent JDK. Can be disabled by running mvn verify -DdisableStaticAnalysis
argline-preview preview property must be on Enable Java preview features. Can be activated by running mvn verify -Dpreview
argline-experimental experimental property must be on Enables ByteBuddy experimental features; useful for testing EqualsVerifier on Early Access JDK builds. Can be activated by running mvn verify -Dexperimental
pitest manual Used by PITest integration on GitHub. Can be activated by running mvn verify -Ppitest


EqualsVerifier uses Prettier-Java through Spotless to format Java files. You can call it using mvn (without any parameters), which will also run the tests and all the other static analysis. Or run mvn spotless:apply to only run the formatter.


This project is a multi-module project to make it easier to deal with shading and multi-release jar files. See this question on StackOverflow for the rationale behind it.

Here's a description of the modules:

module purpose
docs project's Jekyll website
equalsverifier-core the actual EqualsVerifier code
equalsverifier-11 tests for Java 11 and up
equalsverifier-16 logic for records, and corresponding tests
equalsverifier-17 logic for sealed classes, and corresponding tests
equalsverifier-test-core tests for the core code
equalsverifier-test-plumbing helpers for tests that are used by multiple projects
equalsverifier-aggregator generic release assembly description, and shared jacoco configuration
equalsverifier-release-main release assembly for jar with dependencies
equalsverifier-release-nodep release assembly for fat jar (with dependencies shaded in)

Signed JAR

The lib/ folder in the equalsverifier-test-core module contains a local Maven repository containing a signed JAR, used to test potential ClassLoader issues. Here's how to install a JAR into it:

mvn org.apache.maven.plugins:maven-install-plugin:2.3.1:install-file \
                        -Dfile=&lt;path-to-file> -DgroupId=&lt;myGroup> \
                        -DartifactId=&lt;myArtifactId> -Dversion=&lt;myVersion> \
                        -Dpackaging=&lt;myPackaging> -DcreateChecksum=true \

The signed JAR itself can be found in this repo.


Copyright 2009-2022 Jan Ouwens