Search code examples
gwtguavaplayn

In PlayN, how can I get the HTML version of my project using Google's Guava libraries to compile?


I can run the Java version of my project fine by simply importing Guava libraries like so:

import com.google.gwt.thirdparty.guava.common.collect.ImmutableList;

Following the advice here, I've added this line to html/pom.xml:

<dependency>
  <groupId>com.google.guava</groupId>
  <artifactId>guava-gwt</artifactId>
  <version>10.0.1</version>
</dependency>

And this line to html/project.gwt.xml file:

<inherits name="com.google.common.collect.Collect"/>

But when I try to GWT-Compile my HTML version in Eclipse, I get errors like the following:

[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?

Solution

  • I think you may be importing the wrong class. Try replacing the com.google.gwt.thirdparty.guava.common.collect.ImmutableList import with com.google.common.collect.ImmutableList.

    Here is a similar question about the Lists class: Trouble with GWT and Guava