Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Guava bundled with GWT

Tags:

guava

gwt

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?

like image 769
Wesley Avatar asked Apr 20 '11 05:04

Wesley


2 Answers

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

like image 124
Ray Avatar answered Nov 20 '22 11:11

Ray


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> 
like image 36
Valdis R Avatar answered Nov 20 '22 11:11

Valdis R