How to make GWT 2.2 work with GIn
Whilst not officially announced GWT 2.2 is out and it breaks GIn. To get around this you will need to recompile GIn with GWT 2.2, or, if you are lazy, you can just download the jar that I prepared earlier
If you choose to recompile GIn yourself you just need to:
- Checkout GIn, instructions here
- Change you GWT_HOME to point to GWT 2.2, this is just an environment variable
- Build GIn via ant by running “ant dist”
Maven tips (if you aren’t using Maven you are done)
If you are using Maven you will need to manually install the jar using the following command (make sure you replace LOCATION_OF_RECOMPILED_GIN_JAR with the physical location of the jar you recompiled or downloaded):
mvn install:install-file -DgroupId=com.googlecode.gwt.inject -DartifactId=gin -Dpackaging=jar -Dversion=1.0-SNAPSHOT -Dfile=LOCATION_OF_RECOMPILED_GIN_JAR/gin-1.0-SNAPSHOT.jar |
Once you have installed the jar you will need to edit the pom to add in the required dependencies (guice-3.0-rc2 and guice-assistedinject-3.0-rc2), locate your Maven repo and then open “gin-1.0-SNAPSHOT.pom” which is located in your .m2 directory (the default location of your .m2 directory is your user home directory so the file should be located at ~/.m2/repository/com/googlecode/gwt/inject/gin/1.0-SNAPSHOT/gin-1.0-SNAPSHOT.pom) and then add the following just above the closing project tag (</project>):
<dependencies> <dependency> <groupId>com.google.inject</groupId> <artifactId>guice</artifactId> <version>3.0-rc2</version> </dependency> <dependency> <groupId>com.google.inject.extensions</groupId> <artifactId>guice-assistedinject</artifactId> <version>3.0-rc2</version> </dependency> </dependencies> |
Hi James
Sorry, but I tried this and it does not work
I am running from eclipse with
gwt2.2
your jar
guice-3.0.jar – from google site
guice-3.0-assistedinject.jar – from google site.
I get the error below:
Not using maven for now. Just working with libs. If you happen to have a full eclipse project, you will just save me days. Any help appreciated
java.lang.RuntimeException: Deferred binding failed for ‘com.google.gwt.sample.contacts.client.gin.ContactsGinjector’ (did you forget to inherit a required module?)
at
……
……
……
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NoClassDefFoundError: javax/inject/Provider
at com.google.inject.internal.MoreTypes.canonicalizeForKey(MoreTypes.java:81)
at com.google.inject.Key.(Key.java:119)
……
……
……