-->

GWT, Guice and GIN compilation

2019-08-16 00:34发布

问题:

I'm trying to build and GWT MVP application using Guice and Gin. I added Guice and GIN jars to my Eclipse project but i'm stuck with this error:

java.lang.NoClassDefFoundError: com/google/inject/internal/util/$Preconditions

I've done a quick Google search and here says the we need to recompile GIN against GWT SDK. Also, the Gin Tutorial mention something about a compilation step.

Isn't enough to add GIN jars to the GWT project, or is mandatory to generate gin.jar from sources? How do i accomplish this with Eclipse (with Google Plugin)?

PS: I'm not using Maven in my Project. Only Eclipse and Google Tools Another PS: Currently using Guice 3.0, Gin 1.5 and GWT 2.3

回答1:

If you are using GWT 2.2 or above try using a latest snapshot of gin 1.1 or higher versions and also upgrade guice 3.0.



回答2:

For Gin 1.5 there is a pre-gwt-2.2 jar and a post-gwt-2.2 jar. Make sure you have the right one. And probably only one of them should be in the WEB-INF/lib. Make sure both gin and guice are in the lib and in Java Build Path->Libraries. I also have aopalliance.jar, guice-assistedinject-3.0.jar and javax.inject.jar. (Also guice-servlet but that isn't part of the problem here). Make sure you have " " in your .gwt.xml file.

And remember in dev mode that gin uses guice to do most of the work.



标签: gwt guice gin