Widget set won't compile in Eclipse due to GWT's validation API prereq

The latest version of GWT requires the validation API jar files. We can no longer compile our custom widget set in Eclipse (Vaadin 6.6.4) because the Vaadin plugin can’t find the validation API jars, even though these are on the project’s build path, and show up when you expand the Referenced Libraries item in the project.

Basically, since Vaadin requires a level of GWT that has new prerequisites, the Vaadin plugin should support finding those prerequisites when compling custom widget sets.

Thanks in advance,
David

P.S. my apologies for this being a duplicate post in another thread, but I thought I should open a separate thread, since the other one was marked as Resolved.

Hi,

Are you using the most recent version of Vaadin Eclipse plug-in? The newest version should add those validation jars to the classpath automatically. If you use the newest version, try to switch to an older Vaadin version in your project and then back to get classpath updated.

-Henri

Yes, I have the latest version of the Vaadin plugin, and I tried the trick you suggested. Here are the errors I get in the console when trying to compile my widget set:

Compiling module com.inlethd.grapeshot.web.vaadin.widgetset.InletencapsulatorWidgetset
   Validating newly compiled units
      [ERROR]
 Errors in 'jar:file:/D:/work/encapsulator/workspace/fragmenter_trunk/Enterprise/GrapeshotEnterprise/lib/gwt-user.jar!/com/google/gwt/editor/client/EditorDriver.java'
         [ERROR]
 Line 20: The import javax.validation.ConstraintViolation cannot be resolved
         [ERROR]
 Line 97: ConstraintViolation cannot be resolved to a type
      [ERROR]
 Errors in 'jar:file:/D:/work/encapsulator/workspace/fragmenter_trunk/Enterprise/GrapeshotEnterprise/lib/gwt-user.jar!/com/google/gwt/editor/client/impl/AbstractSimpleBeanEditorDriver.java'
         [ERROR]
 Line 28: Name clash: The method setConstraintViolations(Iterable<ConstraintViolation<?>>) of type BaseEditorDriver<T,E> has the same erasure as setConstraintViolations(Iterable<ConstraintViolation<?>>) of type EditorDriver<T> but does not override it
      [ERROR]
 Errors in 'jar:file:/D:/work/encapsulator/workspace/fragmenter_trunk/Enterprise/GrapeshotEnterprise/lib/gwt-user.jar!/com/google/gwt/editor/client/impl/BaseEditorDriver.java'
         [ERROR]
 Line 31: The import javax.validation.ConstraintViolation cannot be resolved
         [ERROR]
 Line 67: ConstraintViolation cannot be resolved to a type
      [ERROR]
 Errors in 'jar:file:/D:/work/encapsulator/workspace/fragmenter_trunk/Enterprise/GrapeshotEnterprise/lib/gwt-user.jar!/com/google/gwt/editor/client/impl/SimpleViolation.java'
         [ERROR]
 Line 25: The import javax.validation.ConstraintViolation cannot be resolved
         [ERROR]
 Line 40: ConstraintViolation cannot be resolved to a type
         [ERROR]
 Line 43: ConstraintViolation cannot be resolved to a type
         [ERROR]
 Line 44: Missing code implementation in the compiler
         [ERROR]
 Line 49: ConstraintViolation cannot be resolved to a type
         [ERROR]
 Line 49: Missing code implementation in the compiler
         [ERROR]
 Line 70: ConstraintViolation cannot be resolved to a type
         [ERROR]
 Line 72: ConstraintViolation cannot be resolved to a type
         [ERROR]
 Line 73: ConstraintViolation<?> cannot be resolved to a type
         [ERROR]
 Line 77: ConstraintViolation<capture#2-of ?> cannot be resolved to a type
         [ERROR]
 Line 81: ConstraintViolation<capture#3-of ?> cannot be resolved to a type
         [ERROR]
 Line 89: ConstraintViolation<capture#4-of ?> cannot be resolved to a type
         [ERROR]
 Line 93: ConstraintViolation<capture#5-of ?> cannot be resolved to a type
         [ERROR]
 Line 98: ConstraintViolation cannot be resolved to a type
      [ERROR]
 Errors in 'jar:file:/D:/work/encapsulator/workspace/fragmenter_trunk/Enterprise/GrapeshotEnterprise/lib/gwt-user.jar!/com/google/gwt/editor/client/testing/MockSimpleBeanEditorDriver.java'
         [ERROR]
 Line 26: The import javax.validation.ConstraintViolation cannot be resolved
         [ERROR]
 Line 35: The type MockSimpleBeanEditorDriver<T,E> must implement the inherited abstract method EditorDriver<T>.setConstraintViolations(Iterable<ConstraintViolation<?>>)
         [ERROR]
 Line 107: Name clash: The method setConstraintViolations(Iterable<ConstraintViolation<?>>) of type MockSimpleBeanEditorDriver<T,E> has the same erasure as setConstraintViolations(Iterable<ConstraintViolation<?>>) of type EditorDriver<T> but does not override it
         [ERROR]
 Line 108: ConstraintViolation cannot be resolved to a type
      [ERROR]
 Errors in 'jar:file:/D:/work/encapsulator/workspace/fragmenter_trunk/Enterprise/GrapeshotEnterprise/lib/gwt-user.jar!/javax/validation/super/javax/validation/Configuration.java'
         [ERROR]
 Line 93: TraversableResolver cannot be resolved to a type
         [ERROR]
 Line 105: ConstraintValidatorFactory cannot be resolved to a type
         [ERROR]
 Line 182: TraversableResolver cannot be resolved to a type
         [ERROR]
 Line 182: No source code is available for type TraversableResolver; did you forget to inherit a required module?
         [ERROR]
 Line 194: ConstraintValidatorFactory cannot be resolved to a type
         [ERROR]
 Line 194: No source code is available for type ConstraintValidatorFactory; did you forget to inherit a required module?
         [ERROR]
 Line 202: ValidatorFactory cannot be resolved to a type
         [ERROR]
 Line 202: No source code is available for type ValidatorFactory; did you forget to inherit a required module?
      [ERROR]
 Errors in 'jar:file:/D:/work/encapsulator/workspace/fragmenter_trunk/Enterprise/GrapeshotEnterprise/lib/gwt-user.jar!/javax/validation/ConstraintViolationException_CustomFieldSerializer.java'
         [ERROR]
 Line 30: ConstraintViolationException cannot be resolved to a type
         [ERROR]
 Line 34: ConstraintViolationException cannot be resolved to a type
         [ERROR]
 Line 34: No source code is available for type ConstraintViolationException; did you forget to inherit a required module?
         [ERROR]
 Line 39: ConstraintViolation cannot be resolved to a type
         [ERROR]
 Line 39: ConstraintViolation cannot be resolved to a type
         [ERROR]
 Line 40: ConstraintViolationException cannot be resolved to a type
         [ERROR]
 Line 44: ConstraintViolationException cannot be resolved to a type
      [ERROR]
 Errors in 'jar:file:/D:/work/encapsulator/workspace/fragmenter_trunk/Enterprise/GrapeshotEnterprise/lib/gwt-user.jar!/javax/validation/super/javax/validation/MessageInterpolator.java'
         [ERROR]
 Line 21: The import javax.validation.metadata cannot be resolved
         [ERROR]
 Line 66: ConstraintDescriptor cannot be resolved to a type
      [ERROR]
 Errors in 'jar:file:/D:/work/encapsulator/workspace/fragmenter_trunk/Enterprise/GrapeshotEnterprise/lib/gwt-user.jar!/javax/validation/super/javax/validation/constraints/Pattern.java'
         [ERROR]
 Line 30: The import javax.validation.Constraint cannot be resolved
         [ERROR]
 Line 31: The import javax.validation.Payload cannot be resolved
         [ERROR]
 Line 49: Constraint cannot be resolved to a type
         [ERROR]
 Line 49: The attribute validatedBy is undefined for the annotation type Constraint
         [ERROR]
 Line 75: Payload cannot be resolved to a type
      [ERROR]
 Errors in 'jar:file:/D:/work/encapsulator/workspace/fragmenter_trunk/Enterprise/GrapeshotEnterprise/lib/gwt-user.jar!/javax/validation/super/javax/validation/spi/ConfigurationState.java'
         [ERROR]
 Line 22: The import javax.validation.ConstraintValidatorFactory cannot be resolved
         [ERROR]
 Line 24: The import javax.validation.TraversableResolver cannot be resolved
         [ERROR]
 Line 93: ConstraintValidatorFactory cannot be resolved to a type
         [ERROR]
 Line 107: TraversableResolver cannot be resolved to a type
   Computing all possible rebind results for 'com.google.gwt.user.client.UserAgentAsserter'
      Rebinding com.google.gwt.user.client.UserAgentAsserter
         Checking rule <generate-with class='com.google.gwt.editor.rebind.SimpleBeanEditorDriverGenerator'/>
            [WARN]
 Detected warnings related to 'com.google.gwt.editor.client.SimpleBeanEditorDriver'.   Are validation-api-<version>.jar and validation-api-<version>-sources.jar on the classpath?
            [WARN]
 Unknown type 'com.google.gwt.editor.client.SimpleBeanEditorDriver' specified in deferred binding rule

Note that my widget set compiles just fine when I do it from an Ant script, but not when using the Vaadin plugin.

The validation JARs are clearly not on the widgetset compilation classpath.

To expand on Henri Kerola’s suggestion: make sure you downgrade and upgrade via Project Properties → Vaadin, and downgrade to a version that would use a different GWT version (e.g. from 6.6.x to 6.5.x). Make sure you apply the changes after each version change.

If you have modified GWT entries on your project build path by hand at some point and they do not have the default values for the Eclipse plug-in, they will not get updated automatically. In that case, you can e.g. remove the entries from the build path and then re-perform the steps above (downgrade and upgrade Vaadin).

It was the latter issue - I had manually updated the GWT entries on the project build path before.

That fixes the compile problems. The problem is that the Vaadin plugin wants to put the GWT jars in the location specified by the VAADIN_DOWNLOAD classpath variable, and that variable is unmodifiable (it appears to be the plugin directory). We would like the jars in a different directory that is part of our project shared in the repository. That way, when someone else loads the project, they will pick up the necessary files. Also, it makes it so the build scripts can find the jars, because they are part of the distribution. Is there any way to specify an alternate location for the Vaadin plugin to put the downloaded jar files?

Thanks,
David

EDIT: Things might be ok here, since removing a jar from the build path does not remove it from its original location. I will update further after I talk with a colleague about this.

The trade-off you make is between either letting the plug-in manage GWT JARs for you or having full control over them but also having to maintain them yourself. There is no problem in keeping your GWT JARs elsewhere (inside or outside the project), but then you have to remember to update them whenever updating Vaadin.

The variable VAADIN_DOWNLOAD is not project specific but the plug-in keeps a single copy of (each version of) the JARs on the computer.

thanks, Henri! Though isn’t the tradeoff also that you cannot compile your widget set in Eclipse if you manage the GWT jars yourself?

I think you are the person who wrote the CustomField add-on, so maybe you can also please take a look at my question regarding that on the add-ons section of the forum. :smiley:

You should be able to, as long as correct versions of all the relevant GWT JARs and dependencies are on the build path, with names that the plug-in recognizes.

Even if the validation JARs would not be there, widgetset compilation should still work - it just prints out a lot of “error” messages.