问题
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" />
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.
<inherits name="com.google.common.base.Base" />
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.
回答1:
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>
来源:https://stackoverflow.com/questions/39356031/including-guava-gwt-in-gwt-app