使用与 GWT 捆绑的 Guava

发布于 2024-11-02 13:27:42 字数 256 浏览 1 评论 0原文

GWT 2.2 及更高版本包括 Guava。包含 Guava 的包是 com.google.gwt.thirdparty.guava。但是,似乎没有模块 XML 文件允许在客户端(可翻译)代码中使用此包。根据这一观察,这个 Guava 副本似乎仅供 GWT 内部使用。

对于使用 Guava 的 GWT 项目,建议的方法是单独下载 Guava 吗?如果没有,在客户端代码中包含 com.google.gwt.thirdparty.guava 的过程是什么?

GWT 2.2 and later includes Guava. The package containing Guava is com.google.gwt.thirdparty.guava. However, there doesn't seem to be a module XML file that would allow this package to be used in client (translatable) code. Based on this observation, it would seem that this copy of Guava is intended for GWT-internal use only.

For GWT projects using Guava, is the suggested approach to download Guava separately? If not, what is the process for including com.google.gwt.thirdparty.guava in client code?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

叹沉浮 2024-11-09 13:27:42

是的,如果您想自己使用 Guava,则需要 guava 和 guava-gwt jar,并在 gwt.xml 文件中引用所需的模块。过去,您还需要 jsr305,尽管我的理解是这个问题正在被修复,所以您在 r09 中可能不需要它

Yes, if you want to use Guava yourself, you'll need the guava and guava-gwt jars, and reference the modules you want in your gwt.xml file. In the past, you've also needed jsr305, although my understanding is that this was being fixed, so you may not need that in r09

°如果伤别离去 2024-11-09 13:27:42

你的假设是正确的;仅供内部使用;单独下载。如果使用 Maven,请在 pom.xml 中包含以下内容:

<dependency>
  <groupId>com.google.guava</groupId>
  <artifactId>guava</artifactId>
  <version>r07</version>
  <scope>compile</scope>
</dependency>
<dependency>
  <groupId>com.google.guava</groupId>
  <artifactId>guava</artifactId>
  <version>r07</version>
  <classifier>gwt</classifier>
  <scope>provided</scope>
</dependency>
<!--  for the source/classes for javax.annotation -->
<dependency>
  <groupId>com.google.code.findbugs</groupId>
  <artifactId>jsr305</artifactId>
  <version>1.3.9</version>
  <scope>provided</scope>
</dependency> 

Your assumption is correct; it's for internal use only; download it separately. If using Maven, include the following in your pom.xml:

<dependency>
  <groupId>com.google.guava</groupId>
  <artifactId>guava</artifactId>
  <version>r07</version>
  <scope>compile</scope>
</dependency>
<dependency>
  <groupId>com.google.guava</groupId>
  <artifactId>guava</artifactId>
  <version>r07</version>
  <classifier>gwt</classifier>
  <scope>provided</scope>
</dependency>
<!--  for the source/classes for javax.annotation -->
<dependency>
  <groupId>com.google.code.findbugs</groupId>
  <artifactId>jsr305</artifactId>
  <version>1.3.9</version>
  <scope>provided</scope>
</dependency> 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文