I am currently using JUnit 4.x with AssertJ. I would like to ensure that no usages of Hamcrest sneak it. However, Hamcrest Core is a required dependency at runtime for JUnit, see Junit issue #1429: A Exception for junit4.12 about org/hamcrest/SelfDescribing #1429 , so excluding the dependency from the pom.xml outright or adjusting the maven-surefire-plugin
classpath would not work.
What I am looking for is a way to adjust the test compiler classpath, but I did not find such an option in the maven-compiler-plugin
.
How can I make sure that my tests do not use Hamcrest assertions? I would like to enforce this at build time, using Maven.