Gwt 在PlayN中,如何使用Google的Guava库来编译项目的HTML版本?
我可以通过如下方式简单地导入Guava库来运行项目的Java版本:Gwt 在PlayN中,如何使用Google的Guava库来编译项目的HTML版本?,gwt,guava,playn,Gwt,Guava,Playn,我可以通过如下方式简单地导入Guava库来运行项目的Java版本: import com.google.gwt.thirdparty.guava.common.collect.ImmutableList; 按照建议,我将这一行添加到html/pom.xml中: <dependency> <groupId>com.google.guava</groupId> <artifactId>guava-gwt</artifactId>
import com.google.gwt.thirdparty.guava.common.collect.ImmutableList;
按照建议,我将这一行添加到html/pom.xml中:
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava-gwt</artifactId>
<version>10.0.1</version>
</dependency>
这一行指向html/project.gwt.xml文件:
<inherits name="com.google.common.collect.Collect"/>
但当我尝试在Eclipse中GWT编译HTML版本时,会出现如下错误:
[ERROR] Line 61: No source code is available for type com.google.gwt.thirdparty.guava.common.collect.ImmutableList<E>; did you forget to inherit a required module?
我想你可能导入了错误的类。尝试将com.google.gwt.thirdparty.guava.common.collect.ImmutableList导入替换为com.google.common.collect.ImmutableList
关于Lists类,这里有一个类似的问题:我认为您可能导入了错误的类。尝试将com.google.gwt.thirdparty.guava.common.collect.ImmutableList导入替换为com.google.common.collect.ImmutableList 关于Lists类,这里有一个类似的问题:我选择了它,因为它让我朝着正确的方向前进。下面是在PlayN项目的HTML版本中启用Guava的更明确说明 一,。向游戏核心/pom.xml添加依赖项 四,。导入时,请使用正确的库路径: 我在下面的链接处编译了代码,并在Chrome中进行了测试,以验证Guava是否成功导入: 我选择了它,因为它让我朝着正确的方向前进。下面是在PlayN项目的HTML版本中启用Guava的更明确说明 一,。向游戏核心/pom.xml添加依赖项 四,。导入时,请使用正确的库路径: 我在下面的链接处编译了代码,并在Chrome中进行了测试,以验证Guava是否成功导入:
我确实看到了将类路径更改为com.google.common.base的情况。尝试了一下,但似乎只会让事情变得更糟。我认为在您的案例中应该是com.google.common.collect。我确实看到了将classpath更改为com.google.common.base的方法。尝试了一下,但似乎只会让事情变得更糟。我认为在你的情况下应该是com.google.common.collect。因此,我需要从import com.google.gwt.thirdparty.guava.common.collect.Foo更改所有导入语句;到com.google.common.collect.Foo;?我同意这是你应该做的。是的,你根本不应该进口gwt第三方产品。这是GWT内部复制的我们古老版本的代码。我遇到的部分问题是com.google.GWT.thirdparty.guava.common.collect是Eclipse出于某种原因似乎更喜欢的路径。Java |外观| Type Filters com.google.GWT.thirdparty.*因此我需要从import更改所有导入语句com.google.gwt.thirdparty.guava.common.collect.Foo;到com.google.common.collect.Foo;?我同意这是你应该做的。是的,你根本不应该进口gwt第三方产品。这是GWT内部复制的我们古老版本的代码。我遇到的部分问题是com.google.GWT.thirdparty.guava.common.collect是Eclipse出于某种原因喜欢的路径。Java |外观|类型过滤器com.google.GWT.thirdparty*
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava-gwt</artifactId>
<version>11.0.2</version>
</dependency>
<inherits name="com.google.common.collect.Collect"/>
import com.google.common.collect.Foo;
/* NOT: import com.google.gwt.thirdparty.guava.common.collect.Foo; */