Getting java.lang.IncompatibleClassChangeError even though dependency conflict is resolved


I’m encountering an extremely weird bug which is breaking my tests. I’m at my wits end with trying to find a solution.

I have two dependencies, Dropwizard, and GWT. GWT is pulling javax.validation:validation-api:1.0.0.GA , and Dropwizard is pulling javax.validation:validation-api:1.1.0.Final. This is causing a conflict.

This was originally a maven project. Initially, it wasn’t compiling at all, but by doing an exclusion and dependencyManagement & setting the version at 1.1.0.Final, I got the project to compile again (using maven).

However, in my unit tests, a class is created via reflection. That class has a bunch of @Valid annotations. As soon as those annotations are encountered, the test dies with a ’ java.lang.IncompatibleClassChangeError’ error.

This error does not occur at runtime - only during tests.

After trying everything I could think of with maven, I’ve decided to give gradle a try, hoping this issue can be fixed.

I’ve run gradle init on the project, however when I run gradle test, I’m seeing the same error.

Would greatly appreciate any help.

Original pom.xml file: generated via gradle init:

Output of ‘gradle dependencies --configuration=testRuntime’ :

Full Stacktrace:

The following line where it breaks:

at io.dropwizard.Configuration.<init>(

contains a @Valid annotation, the first one in the class.

Please help me.