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

Heya,

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: https://gist.github.com/aliakhtar/fa4ba617b538bfa065967ddf6baca130

gradle.build generated via gradle init: https://gist.github.com/aliakhtar/fc7407dcc1d36e050ae29e665d7bc61c

Output of ‘gradle dependencies --configuration=testRuntime’ : https://gist.github.com/aliakhtar/72227cc3bc4ff9d526d4477505d5dce8

Full Stacktrace: https://gist.github.com/aliakhtar/4b8b296547635050a415f8b65129511b

The following line where it breaks:

at io.dropwizard.Configuration.<init>(Configuration.java:63)

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

Please help me.