Friday, April 15, 2016

Re: gwt-dev and javax-validation:validation-api



On Friday, April 15, 2016 at 4:03:36 AM UTC+2, Ali Akhtar wrote:
Heya,

I'm using Dropwizard and GWT in the same project. Problem is, Dropwizard relies on javax-validation:validation-api 1.1.0.Final and GWT uses an older version of the lib.

With dependencyManagement, I've got the project to compile & run correctly. BUT, at test time, I get the following lovely error:

java.lang.IncompatibleClassChangeError: Implementing class


This happens when a class is being deserialized from Json by jackson, and that class uses a @Valid annotation.

I've tried all sorts of exclusions and dependencyManagements, changing scopes, etc but nothing worked, however if I take out gwt-dev, then it magically starts working.

Questions:

1) What's in gwt-dev which is causing validation-api to get included during tests (not at runtime) even when explicitly excluded?

gwt-dev contains all sort of classes (from third parties, bundled into a fat-jar) that are quite likely to conflict with non-GWT dependencies.
This is why you should setup different classpaths for GWT- and non-GWT-related (server-side) tasks; and with Maven you have no other choice than using distinct modules.
 
2) It seems taking out gwt-dev causes SDM to not work, but other things continue working. Is it possible to exclude gwt-dev only for tests, but include it at dev time so SDM can work? (Right now, I've resorted to manually uncommenting gwt-dev when SDM needs to run but keeping it commented otherwise. Sooper hi tech)

maven-surefire-plugin allows you to define classpath exclusions: https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#classpathDependencyExcludes
(but you really should try turning your project into a multi-module one)

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment