番石榴,gwt和eclipse [英] guava, gwt and eclipse

查看:146
本文介绍了番石榴,gwt和eclipse的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在gwt web应用程序的客户端代码中使用guava?如果是这样,一个人如何在一个Eclipse项目中添加番石榴?



我已经将guava-10.0.1和guava-gwt-10.0.1 jar添加到了我的项目中构建路径并添加了源附件到每个,但我仍然得到这个错误:


类型
没有源代码可用com.google.gwt.thirdparty.guava.common.base.Predicate;是不是你的
忘记继承一个必需的模块?



解决方案

进口线。它看起来像这样吗?

  import com.google.gwt.thirdparty.guava.common.base.Predicate; 

这是错误的。将其更改为:

  import com.google.common.base.Predicate; 

如果您在Eclipse中使用完成辅助 - Control-Spacebar - 研究提供的完成列表。不要只挑第一个。向右看,它将在浅灰色文本中识别完成的来源。如果您正在查看第三方.guava,请移至下一个,直到您看到google.common为止。



也许有人可以深入了解第三方.guava库用于,无论它是否需要在构建路径中,以及Guava图书馆应该以什么顺序出现在典型的GWT项目中。

Is it possible to use guava in the client side code of a gwt web application? If so, how does one add guava to an Eclipse project?

I've added both the guava-10.0.1 and guava-gwt-10.0.1 jars to my build path and have added the source attachments to each but I still get this error:

No source code is available for type com.google.gwt.thirdparty.guava.common.base.Predicate; did you forget to inherit a required module

解决方案

OK, look at your import line. Does it look like this?

import com.google.gwt.thirdparty.guava.common.base.Predicate;

That's wrong. Change it to:

import com.google.common.base.Predicate;

If you use completion assist in Eclipse -- Control-Spacebar -- study the list of offered completions. Don't just pick the first one. Look to the right where it will identify the source of the completion in light grey text. If you are looking at the thirdparty.guava one, move to the next one until you see the google.common one.

Maybe someone can give some insight into what the thirdparty.guava library is used for, whether it needs to be in the build path, and in what order Guava libraries ought to appear in the typical GWT project.

这篇关于番石榴,gwt和eclipse的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆