本文介绍了在GWT应用程序中包含Guava GWT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在我的GWT 2.6.1应用程序中添加番石榴。我包括guava-19.0.jar和guava-gwt-19.0.jar。

我添加了

看看 guava-gwt 的POM,你会发现它有它自己的依赖关系,包括j2objc。

 < dependency> 
< groupId> com.google.j2objc< / groupId>
< artifactId> j2objc-annotations< / artifactId>
<可选> false< /可选>
< /依赖关系>


I'm trying to add guava to my GWT 2.6.1 application. I included guava-19.0.jar and guava-gwt-19.0.jar.

I added<inherits name="com.google.common.collect.Collect" />
<inherits name="com.google.common.base.Base" /> to my "MyApp.gwt.xml" file. When I go to run the app via Super Dev mode, I get this error, and I'm not sure what to do.

Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
   [ERROR] Errors in 'jar:file:/C:/Projects/my_proj/code/my_gwt_app/main_app/libs/guava/guava-gwt-19.0.jar!/com/google/common/collect/super/com/google/common/collect/RegularImmutableAsList.java'
      [ERROR] Line 20: The import com.google.j2objc cannot be resolved
      [ERROR] Line 31: Weak cannot be resolved to a type
[ERROR] Compiler returned false

I have a single class that is using guava, and has the following imports:

import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;

I'm not following what the "super" folder/package reference is to. I see a com.google.common.collect.super.com.google.common.collect package, but i'm not sure how to refer to it in my gwt.xml file.

解决方案

Look at the POM of guava-gwt, and you will see that it has its own dependencies, including j2objc.

<dependency>
    <groupId>com.google.j2objc</groupId>
    <artifactId>j2objc-annotations</artifactId>
    <optional>false</optional>
</dependency>

这篇关于在GWT应用程序中包含Guava GWT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 09:41
查看更多