0

我正在尝试将 GWT 升级到 v2.4。我正面临问题。当 Run As -> Ant Built (升级项目后)时,缺少 .xml 文件(项目中未生成)并且项目构建成功,但有奇怪的行为在控制台中显示错误。我将发布出现的错误(其中一些)。

我正在使用以下内容:

  • 操作系统是Windows。

  • 我将编译器设为 jdk1.7 而不是 jre1.5。

  • 我在环境变量中设置了这些:类路径指向 C:\Program Files\Documentum\dctm.jar;C:\Documentum\config;%GWT_HOME%;%GWT_HOME%\gwt-user.jar;%GWT_HOME%\gwt- dev.jar;%GWT_HOME%\gwt-servlet.jar;%junit%

  • GWT_HOME D:\products\DSS 2012\eclipse-jee-indigo-SR2-win32\eclipse\plugins\com.google.gwt.eclipse.sdkbundle_2.4.0.v201205021203-rel-r37\gwt-2.4.0

  • JAVA_HOME "C:\Program Files\Java\jdk1.7.0_05"

  • junit %JUNIT_HOME%\junit.jar

  • JUNIT_HOME D:\products\DSS 2012\eclipse-jee-indigo-SR2-win32\eclipse\plugins\org.junit_4.8.2.v4_8_2_v20110321-1705

在 eclipse --> Preferences --> Java --> compiler --> Compiler 合规级别为 1.7

在 eclipse --> Preferences --> Java --> Installed JREs --> 设置为 jdk1.7.0_05

这些是编译时出现的一些错误(我得到的结果是编译成功)

[java] Loaded 2283 units from persistent store.
 [java]    Found 2215 cached units.  Used 2215 / 2215 units from cache.
 [java]    Added 0 units to persistent cache.
 [java]    Validating newly compiled units
 [java]       Errors in 'jar:file:/D:/products/DSS%202012/eclipse-jee-indigo-SR2-win32/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201205021203-rel-r37/gwt-2.4.0/gwt-user.jar!/com/google/gwt/editor/client/EditorDriver.java'
 [java]          Line 20: The import javax.validation.ConstraintViolation cannot be resolved
 [java]          Line 97: ConstraintViolation cannot be resolved to a type
 [java]       Errors in 'jar:file:/D:/products/DSS%202012/eclipse-jee-indigo-SR2-win32/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201205021203-rel-r37/gwt-2.4.0/gwt-user.jar!/com/google/gwt/editor/client/impl/AbstractSimpleBeanEditorDriver.java'
 [java]          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
 [java]       Errors in 'jar:file:/D:/products/DSS%202012/eclipse-jee-indigo-SR2-win32/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201205021203-rel-r37/gwt-2.4.0/gwt-user.jar!/com/google/gwt/editor/client/impl/BaseEditorDriver.java'
 [java]          Line 31: The import javax.validation.ConstraintViolation cannot be resolved
 [java]          Line 66: ConstraintViolation cannot be resolved to a type
 [java]       Errors in 'jar:file:/D:/products/DSS%202012/eclipse-jee-indigo-SR2-win32/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201205021203-rel-r37/gwt-2.4.0/gwt-user.jar!/com/google/gwt/editor/client/impl/SimpleViolation.java'
 [java]          Line 25: The import javax.validation.ConstraintViolation cannot be resolved
 [java]          Line 40: ConstraintViolation cannot be resolved to a type
 [java]          Line 43: ConstraintViolation cannot be resolved to a type
 [java]          Line 44: Missing code implementation in the compiler
 [java]          Line 49: ConstraintViolation cannot be resolved to a type
 [java]          Line 49: Missing code implementation in the compiler
 [java]          Line 70: ConstraintViolation cannot be resolved to a type
 [java]          Line 72: ConstraintViolation cannot be resolved to a type
 [java]          Line 73: ConstraintViolation<?> cannot be resolved to a type
 [java]          Line 78: ConstraintViolation<capture#2-of ?> cannot be resolved to a type
 [java]          Line 83: ConstraintViolation<capture#3-of ?> cannot be resolved to a type
 [java]          Line 92: ConstraintViolation<capture#4-of ?> cannot be resolved to a type
 [java]          Line 97: ConstraintViolation<capture#5-of ?> cannot be resolved to a type
 [java]          Line 102: ConstraintViolation cannot be resolved to a type
 [java]       Errors in 'jar:file:/D:/products/DSS%202012/eclipse-jee-indigo-SR2-win32/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201205021203-rel-r37/gwt-2.4.0/gwt-user.jar!/com/google/gwt/editor/client/testing/MockSimpleBeanEditorDriver.java'
 [java]          Line 26: The import javax.validation.ConstraintViolation cannot be resolved
 [java]          Line 35: The type MockSimpleBeanEditorDriver<T,E> must implement the inherited abstract method EditorDriver<T>.setConstraintViolations(Iterable<ConstraintViolation<?>>)
 [java]          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
 [java]          Line 108: ConstraintViolation cannot be resolved to a type
 [java]       Errors in 'jar:file:/D:/products/DSS%202012/eclipse-jee-indigo-SR2-win32/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201205021203-rel-r37/gwt-2.4.0/gwt-user.jar!/com/google/gwt/validation/client/AbstractGwtValidatorFactory.java'
 [java]          Line 21: The import javax.validation.ConstraintValidatorFactory cannot be resolved
 [java]          Line 23: The import javax.validation.TraversableResolver cannot be resolved
 [java]          Line 24: The import javax.validation.Validator cannot be resolved
 [java]          Line 25: The import javax.validation.ValidatorContext cannot be resolved
 [java]          Line 26: The import javax.validation.ValidatorFactory cannot be resolved
 [java]          Line 57: ValidatorFactory cannot be resolved to a type
 [java]          Line 67: ConstraintValidatorFactory cannot be resolved to a type
 [java]          Line 68: The method create(Class<?>) from the type GWT refers to the missing type ConstraintValidatorFactory
 [java]          Line 68: ConstraintValidatorFactory cannot be resolved to a type
 [java]          Line 75: TraversableResolver cannot be resolved to a type
 [java]          Line 76: The method create(Class<?>) from the type GWT refers to the missing type TraversableResolver
 [java]          Line 76: TraversableResolver cannot be resolved to a type
 [java]          Line 79: Validator cannot be resolved to a type
 [java]          Line 81: The method getConstraintValidatorFactory() from the type AbstractGwtValidatorFactory refers to the missing type ConstraintValidatorFactory
 [java]          Line 82: The method getTraversableResolver() from the type AbstractGwtValidatorFactory refers to the missing type TraversableResolver
 [java]          Line 91: ValidatorContext cannot be resolved to a type
 [java]          Line 92: The method create(Class<?>) from the type GWT refers to the missing type ValidatorContext
 [java]          Line 92: ValidatorContext cannot be resolved to a type
 [java]       Errors in 'jar:file:/D:/products/DSS%202012/eclipse-jee-indigo-SR2-win32/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201205021203-rel-r37/gwt-2.4.0/gwt-user.jar!/com/google/gwt/validation/client/BaseGwtConfiguration.java'
 [java]          Line 23: The import javax.validation.ConstraintValidatorFactory cannot be resolved
 [java]          Line 25: The import javax.validation.TraversableResolver cannot be resolved
 [java]          Line 26: The import javax.validation.ValidatorFactory cannot be resolved
 [java]          Line 27: The import javax.validation.spi.BootstrapState cannot be resolved
 [java]          Line 40: BootstrapState cannot be resolved to a type
 [java]          Line 43: BootstrapState cannot be resolved to a type
 [java]          Line 45: BootstrapState cannot be resolved to a type
 [java]          Line 53: ValidatorFactory cannot be resolved to a type
 [java]          Line 55: The method buildValidatorFactory(ConfigurationState) from the type GwtValidationProvider refers to the missing type ValidatorFactory
 [java]          Line 59: ConstraintValidatorFactory cannot be resolved to a type
 [java]          Line 64: ConstraintValidatorFactory cannot be resolved to a type
 [java]          Line 65: The method create(Class<?>) from the type GWT refers to the missing type ConstraintValidatorFactory
 [java]          Line 65: ConstraintValidatorFactory cannot be resolved to a type
 [java]          Line 72: TraversableResolver cannot be resolved to a type
 [java]          Line 73: The method create(Class<?>) from the type GWT refers to the missing type TraversableResolver
 [java]          Line 73: TraversableResolver cannot be resolved to a type
 [java]          Line 88: TraversableResolver cannot be resolved to a type
 [java]       Errors in 'jar:file:/D:/products/DSS%202012/eclipse-jee-indigo-SR2-win32/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201205021203-rel-r37/gwt-2.4.0/gwt-user.jar!/com/google/gwt/validation/client/BaseMessageInterpolator.java'
 [java]          Line 26: The import javax.validation.metadata cannot be resolved
 [java]          Line 41: ConstraintDescriptor cannot be resolved to a type
 [java]          Line 44: ConstraintDescriptor cannot be resolved to a type
 [java]          Line 45: ConstraintDescriptor<?> cannot be resolved to a type
 [java]          Line 49: ConstraintDescriptor cannot be resolved to a type
 [java]          Line 50: ConstraintDescriptor<capture#2-of ?> cannot be resolved to a type
 [java]          Line 134: The method getConstraintDescriptor() from the type MessageInterpolator.Context refers to the missing type ConstraintDescriptor
 [java]       Errors in 'jar:file:/D:/products/DSS%202012/eclipse-jee-indigo-SR2-win32/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201205021203-rel-r37/gwt-2.4.0/gwt-user.jar!/com/google/gwt/validation/client/GwtConstraintValidatorFactory.java'
 [java]          Line 18: The import javax.validation.ConstraintValidator cannot be resolved
 [java]          Line 19: The import javax.validation.ConstraintValidatorFactory cannot be resolved
 [java]          Line 46: ConstraintValidatorFactory cannot be resolved to a type
 [java]          Line 53: ConstraintValidator cannot be resolved to a type
 [java]          Line 55: ConstraintValidatorFactory cannot be resolved to a type
 [java]       Errors in 'jar:file:/D:/products/DSS%202012/eclipse-jee-indigo-SR2-win32/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201205021203-rel-r37/gwt-2.4.0/gwt-user.jar!/com/google/gwt/validation/client/GwtTraversableResolver.java'
 [java]          Line 20: The import javax.validation.Path cannot be resolved
 [java]          Line 21: The import javax.validation.Path cannot be resolved
 [java]          Line 22: The import javax.validation.TraversableResolver cannot be resolved
 [java]          Line 30: TraversableResolver cannot be resolved to a type
 [java]          Line 33: Node cannot be resolved to a type
 [java]          Line 34: Path cannot be resolved to a type
 [java]          Line 40: Node cannot be resolved to a type
 [java]          Line 41: Path cannot be resolved to a type
 [java]       Errors in 'jar:file:/D:/products/DSS%202012/eclipse-jee-indigo-SR2-win32/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201205021203-rel-r37/gwt-2.4.0/gwt-user.jar!/com/google/gwt/validation/client/GwtValidationProviderResolver.java'
 [java]          Line 24: The import javax.validation.ValidationProviderResolver cannot be resolved
 [java]          Line 25: The import javax.validation.spi.ValidationProvider cannot be resolved
 [java]          Line 35: ValidationProviderResolver cannot be resolved to a type
 [java]          Line 37: ValidationProvider cannot be resolved to a type
 [java]          Line 38: The method createValidationProviderList() from the type GwtValidationProviderResolver refers to the missing type ValidationProvider
 [java]          Line 40: ValidationProvider cannot be resolved to a type
 [java]          Line 41: ValidationProvider cannot be resolved to a type
 [java]          Line 41: ValidationProvider cannot be resolved to a type
 [java]          Line 42: ValidationProvider cannot be resolved to a type
 [java]          Line 42: The method create(Class<?>) from the type GWT refers to the missing type ValidationProvider
 [java]          Line 42: ValidationProvider cannot be resolved to a type
 [java]          Line 47: ValidationProvider cannot be resolved to a type
 [java]          Line 48: Missing code implementation in the compiler
 [java]       Errors in 'jar:file:/D:/products/DSS%202012/eclipse-jee-indigo-SR2-win32/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201205021203-rel-r37/gwt-2.4.0/gwt-user.jar!/com/google/gwt/validation/client/GwtValidatorContext.java'
 [java]          Line 21: The import javax.validation.ConstraintValidatorFactory cannot be resolved
 [java]          Line 23: The import javax.validation.TraversableResolver cannot be resolved
 [java]          Line 24: The import javax.validation.Validator cannot be resolved
 [java]          Line 25: The import javax.validation.ValidatorContext cannot be resolved
 [java]          Line 26: The import javax.validation.ValidatorFactory cannot be resolved
 [java]          Line 34: ValidatorContext cannot be resolved to a type
 [java]          Line 36: ValidatorFactory cannot be resolved to a type
 [java]          Line 38: ConstraintValidatorFactory cannot be resolved to a type
 [java]          Line 38: The method getConstraintValidatorFactory() from the type AbstractGwtValidatorFactory refers to the missing type ConstraintValidatorFactory
 [java]          Line 40: TraversableResolver cannot be resolved to a type
 [java]          Line 40: The method getTraversableResolver() from the type AbstractGwtValidatorFactory refers to the missing type TraversableResolver
 [java]          Line 42: ValidatorContext cannot be resolved to a type
 [java]          Line 43: ConstraintValidatorFactory cannot be resolved to a type
 [java]          Line 45: ConstraintValidatorFactory cannot be resolved to a type
 [java]          Line 45: ConstraintValidatorFactory cannot be resolved to a type
 [java]          Line 47: ConstraintValidatorFactory cannot be resolved to a type
 [java]          Line 52: Validator cannot be resolved to a type
 [java]          Line 54: ConstraintValidatorFactory cannot be resolved to a type
 [java]          Line 55: TraversableResolver cannot be resolved to a type
 [java]          Line 59: ValidatorContext cannot be resolved to a type
 [java]          Line 69: ValidatorContext cannot be resolved to a type
 [java]          Line 70: TraversableResolver cannot be resolved to a type
 [java]          Line 72: TraversableResolver cannot be resolved to a type
 [java]          Line 72: TraversableResolver cannot be resolved to a type
 [java]          Line 74: TraversableResolver cannot be resolved to a type
 [java]       Errors in 'jar:file:/D:/products/DSS%202012/eclipse-jee-indigo-SR2-win32/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201205021203-rel-r37/gwt-2.4.0/gwt-user.jar!/com/google/gwt/validation/client/Validation.java'
 [java]          Line 23: The import javax.validation.ValidationException cannot be resolved
 [java]          Line 24: The import javax.validation.ValidationProviderResolver cannot be resolved
 [java]          Line 25: The import javax.validation.ValidatorFactory cannot be resolved
 [java]          Line 26: The import javax.validation.bootstrap cannot be resolved
 [java]          Line 27: The import javax.validation.bootstrap cannot be resolved
 [java]          Line 28: The import javax.validation.spi.BootstrapState cannot be resolved
 [java]          Line 29: The import javax.validation.spi.ValidationProvider cannot be resolved
 [java]          Line 93: GenericBootstrap cannot be resolved to a type
 [java]          Line 94: BootstrapState cannot be resolved to a type
 [java]          Line 96: ValidationProviderResolver cannot be resolved to a type
 [java]          Line 97: ValidationProviderResolver cannot be resolved to a type
 [java]          Line 100: ValidationProviderResolver cannot be resolved to a type
 [java]          Line 100: ValidationProviderResolver cannot be resolved to a type
 [java]          Line 101: The method getDefaultValidationProviderResolver() from the type Validation.GenericBootstrapImpl refers to the missing type ValidationProviderResolver
 [java]          Line 101: ValidationProviderResolver cannot be resolved to a type
 [java]          Line 103: ValidationProvider cannot be resolved to a type
 [java]          Line 107: ValidationException cannot be resolved to a type
 [java]          Line 113: ValidationException cannot be resolved to a type
 [java]          Line 121: ValidationException cannot be resolved to a type
 [java]          Line 128: ValidationProviderResolver cannot be resolved to a type
 [java]          Line 129: ValidationProviderResolver cannot be resolved to a type
 [java]          Line 130: ValidationProviderResolver cannot be resolved to a type
 [java]          Line 130: ValidationProviderResolver cannot be resolved to a type
 [java]          Line 132: ValidationProviderResolver cannot be resolved to a type
 [java]          Line 135: ValidationProviderResolver cannot be resolved to a type
 [java]          Line 136: ValidationProviderResolver cannot be resolved to a type
 [java]          Line 139: GenericBootstrap cannot be resolved to a type
 [java]          Line 139: ValidationProviderResolver cannot be resolved to a type
 [java]          Line 140: ValidationProviderResolver cannot be resolved to a type
 [java]          Line 147: ValidationProvider cannot be resolved to a type
 [java]          Line 148: ProviderSpecificBootstrap cannot be resolved to a type
 [java]          Line 150: ValidationProviderResolver cannot be resolved to a type
 [java]          Line 166: ValidationException cannot be resolved to a type
 [java]          Line 171: ValidationProviderResolver cannot be resolved to a type
 [java]          Line 172: ValidationProviderResolver cannot be resolved to a type
 [java]          Line 172: The method getDefaultValidationProviderResolver() from the type Validation.GenericBootstrapImpl refers to the missing type ValidationProviderResolver
 [java]          Line 175: ValidationProviderResolver cannot be resolved to a type
 [java]          Line 178: ValidationProvider cannot be resolved to a type
 [java]          Line 180: ValidationProviderResolver cannot be resolved to a type
 [java]          Line 182: ValidationException cannot be resolved to a type
 [java]          Line 186: ValidationProvider cannot be resolved to a type
 [java]          Line 190: ValidationProvider cannot be resolved to a type
 [java]          Line 190: ValidationProvider cannot be resolved to a type
 [java]          Line 194: ValidationException cannot be resolved to a type
 [java]          Line 206: ProviderSpecificBootstrap cannot be resolved to a type
 [java]          Line 207: ValidationProviderResolver cannot be resolved to a type
 [java]          Line 208: ValidationProviderResolver cannot be resolved to a type
 [java]          Line 227: ValidatorFactory cannot be resolved to a type
 [java]          Line 228: The method byDefaultProvider() from the type Validation refers to the missing type GenericBootstrap
 [java]          Line 248: GenericBootstrap cannot be resolved to a type
 [java]          Line 276: ValidationProvider cannot be resolved to a type
 [java]          Line 277: ProviderSpecificBootstrap cannot be resolved to a type
 [java]          Line 278: Bound mismatch: The type U is not a valid substitute for the bounded parameter <U extends ValidationProvider<T>> of the type Validation.ProviderSpecificBootstrapImpl<T,U>
 [java]       Errors in 'jar:file:/D:/products/DSS%202012/eclipse-jee-indigo-SR2-win32/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201205021203-rel-r37/gwt-2.4.0/gwt-user.jar!/com/google/gwt/validation/client/constraints/AbstractDecimalMaxValidator.java'
 [java]          Line 20: The import javax.validation.ConstraintValidator cannot be resolved
 [java]          Line 21: The import javax.validation.constraints.DecimalMax cannot be resolved
 [java]          Line 31: ConstraintValidator cannot be resolved to a type
 [java]          Line 31: DecimalMax cannot be resolved to a type
 [java]          Line 39: DecimalMax cannot be resolved to a type
 [java]       Errors in 'jar:file:/D:/products/DSS%202012/eclipse-jee-indigo-SR2-win32/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201205021203-rel-r37/gwt-2.4.0/gwt-user.jar!/com/google/gwt/validation/client/constraints/AbstractDecimalMinValidator.java'
 [java]          Line 20: The import javax.validation.ConstraintValidator cannot be resolved
 [java]          Line 21: The import javax.validation.constraints.DecimalMin cannot be resolved
 [java]          Line 30: ConstraintValidator cannot be resolved to a type
 [java]          Line 30: DecimalMin cannot be resolved to a type
 [java]          Line 34: DecimalMin cannot be resolved to a type
 [java]       Errors in 'jar:file:/D:/products/DSS%202012/eclipse-jee-indigo-SR2-win32/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201205021203-rel-r37/gwt-2.4.0/gwt-user.jar!/com/google/gwt/validation/client/constraints/AbstractDigitsValidator.java'
 [java]          Line 20: The import javax.validation.ConstraintValidator cannot be resolved
 [java]          Line 21: The import javax.validation.constraints.Digits cannot be resolved
 [java]          Line 30: ConstraintValidator cannot be resolved to a type
 [java]          Line 30: Digits cannot be resolved to a type
 [java]          Line 35: Digits cannot be resolved to a type
 [java]       Errors in 'jar:file:/D:/products/DSS%202012/eclipse-jee-indigo-SR2-win32/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201205021203-rel-r37/gwt-2.4.0/gwt-user.jar!/com/google/gwt/validation/client/constraints/AbstractMaxValidator.java'
 [java]          Line 21: The import javax.validation.ConstraintValidator cannot be resolved
 [java]          Line 22: The import javax.validation.constraints.Max cannot be resolved
 [java]          Line 29: ConstraintValidator cannot be resolved to a type
 [java]          Line 29: Max cannot be resolved to a type
 [java]          Line 33: Max cannot be resolved to a type

我不知道该怎么办。请任何帮助。

谢谢并恭祝安康,

阿里

4

2 回答 2

3

您必须将validation-api-1.0.0.GA.jar和添加validation-api-1.0.0.GA-sources.jar到类路径。

顺便说一句,您不需要gwt-servlet.jar在类路径中,因为它是gwt-user.jarand的子集gwt-dev.jar;并且您应该将编译器合规性级别设置为 1.6,因为 GWT(尚)不支持 Java 7 功能(您可以使用 JDK 7——除非您使用请求工厂,那么您需要升级到 GWT 2.5.0-rc1 – 但是您必须使编译器符合 1.6,或者至少确保您不使用任何 Java 7 功能 – 菱形运算符、打开字符串等 –)。

于 2012-07-15T13:41:21.740 回答
2

有2点:

  1. GWT 2.4(源代码)仅与 Java 6 兼容。因此,您不能使用 Java 7 功能,因为它们无法使用 GWT 编译器进行编译。这就是为什么您应该使用 1.6 作为合规级别。
  2. GWT 2.4 的编辑器框架需要验证 api (javax.validation) 才能正常工作。validation-api-1.0.0.GA.jar 和 validation-api-1.0.0.GA-sources.jar 应该包含在您下载的 GWT 发行版中。将它们包含在您的类路径中。
于 2012-07-15T13:49:31.553 回答