gpt4 book ai didi

java - GWT Gin 2.1 不支持 major.minor 版本 51.0

转载 作者:行者123 更新时间:2023-11-30 09:20:03 25 4
gpt4 key购买 nike

我在尝试编译 gwt 项目时遇到错误,这通常是由 jre 1.7 (51.0) 编译类引起的。我已经验证我的类正在使用 1.6 版本进行编译。我几乎肯定这是包含在类路径中的其他一些类,但是在调试 Maven 构建时我无法让 gwt 编译器中断。我正在使用 eclipse 尝试中断调试 maven 构建并为 UnsupportClassVersionError 和 UnableToCompleteException 添加断点,但发生这种情况时 jvm 没有停止。我猜测 GWT 编译器可能在单独的进程下运行,我将无法轻松捕获这些异常。任何指针将不胜感激。我宁愿找到一种方法来打破 gwt 异常,但如果有人知道为什么 GIN 提示无效的类修订,那也很好。

这是我尝试使用 maven 从命令行编译时的错误。

[INFO] --- gwt-maven-plugin:2.5.1:compile (default) @ smartbar ---
[INFO] Loading inherited module 'com.smartbar.SmartBar'
[INFO] Loading inherited module 'com.smartbar.SmartBarCommon'
[INFO] Loading inherited module 'com.google.gwt.inject.Inject'
[INFO] [ERROR] Unexpected error while processing XML
[INFO] java.lang.UnsupportedClassVersionError: com/google/gwt/inject/rebind/GinjectorGenerator : Unsupported major.minor version 51.0
[INFO] at java.lang.ClassLoader.defineClass1(Native Method)
[INFO] at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
[INFO] at java.lang.ClassLoader.defineClass(ClassLoader.java:615)


chinshaw$ java -version
java version "1.6.0_51"
Java(TM) SE Runtime Environment (build 1.6.0_51-b11-457-11M4509)
Java HotSpot(TM) 64-Bit Server VM (build 20.51-b01-457, mixed mode)


chinshaw$ find . -name '*.class' | xargs file | head -10
./WEB-INF/classes/com/testing/client/activity/AbstractActivity.class: compiled Java class data, version 50.0 (Java 1.6)
./WEB-INF/classes/com/testing/client/activity/EstablishmentInventoryActivity.class: compiled Java class data, version 50.0 (Java 1.6)
./WEB-INF/classes/com/testing/client/activity/EstablishmentNavigationActivity.class: compiled Java class data, version 50.0 (Java 1.6)
./WEB-INF/classes/com/testing/client/ClientUserSession.class: compiled Java class data, version 50.0 (Java 1.6)
./WEB-INF/classes/com/testing/client/events/EntityEditEvent$Handler.class: compiled Java class data, version 50.0 (Java 1.6)
./WEB-INF/classes/com/testing/client/events/EntityEditEvent.class: compiled Java class data, version 50.0 (Java 1.6)
./WEB-INF/classes/com/testing/client/events/InventoryItemSelectionEvent$Handler.class: compiled Java class data, version 50.0 (Java 1.6)
./WEB-INF/classes/com/testing/client/events/InventoryItemSelectionEvent.class: compiled Java class data, version 50.0 (Java 1.6)
./WEB-INF/classes/com/testing/client

临时解决方案

这可能只是 maven 存储库的问题,但看起来 2.1.0 的 gin 包是用 1.7.0 构建的。我将我的依赖项降级为 2.0.0,现在它工作正常。

desktop-mini:2.1.0 chinshaw$ pwd
/Users/chinshaw/.m2/repository/com/google/gwt/inject/gin/2.1.0
desktop-mini:inject chinshaw$ find . -name '*.class' -exec file {} \; | head -10
./client/AbstractGinModule.class: compiled Java class data, version 51.0
./client/assistedinject/BindingCollector.class: compiled Java class data, version 51.0
./client/assistedinject/FactoryModule.class: compiled Java class data, version 51.0
./client/assistedinject/GinFactoryModuleBuilder.class: compiled Java class data, version 51.0
./client/AsyncProvider.class: compiled Java class data, version 51.0
./client/binder/GinAnnotatedBindingBuilder.class: compiled Java class data, version 51.0
./client/binder/GinAnnotatedConstantBindingBuilder.class: compiled Java class data, version 51.0
./client/binder/GinAnnotatedElementBuilder.class: compiled Java class data, version 51.0
./client/binder/GinBinder.class: compiled Java class data, version 51.0
./client/binder/GinConstantBindingBuilder.class: compiled Java class data, version 51.0

这是错误 ID,真希望我先看过那里。不过,首先假设这是另一个 jar 的问题。 http://code.google.com/p/google-gin/issues/detail?id=190

最佳答案

enforceBytecodeVersion Enforcer Rule 应该能够帮助您解决此类问题。它将遍历所有依赖项以检查它们是否与所需的类版本匹配。

关于java - GWT Gin 2.1 不支持 major.minor 版本 51.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17632881/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com