Compiling GWT project using GUICE with ANT
I can successfully compile the source, but when I hit this ant task:
开发者_JAVA技巧 <target name="gwtc" depends="javac" description="GWT compile to JavaScript">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
<classpath>
<pathelement location="src"/>
<path refid="project.class.path"/>
</classpath>
<jvmarg value="-Xmx256M"/>
<arg line="${gwt.args}"/>
<arg value="com.jwavro.jaguar.jaguar"/>
</java>
</target>
I'm getting these errors:
gwtc: [java] Compiling module com.jwavro.jaguar.jaguar [java] Scanning for additional dependencies: generated://9161C2B729E3521B2A51CBE6F2AE8A77/com/unnison/framework/client/GeneratedGinInjector.java [java] Computing all possible rebind results for 'com.unnison.framework.client.GeneratedGinInjector' [java] Rebinding com.unnison.framework.client.GeneratedGinInjector [java] Invoking generator com.google.gwt.inject.rebind.GinjectorGenerator [java] [ERROR] Generator 'com.google.gwt.inject.rebind.GinjectorGenerator' threw an exception while rebinding 'com.unnison.framework.client.GeneratedGinInjector' [java] com.google.inject.CreationException: Guice creation errors: [java] [java] 1) No implementation for javax.inject.Provider was bound. [java] while locating javax.inject.Provider [java] for parameter 9 at com.google.gwt.inject.rebind.BindingsProcessor.(BindingsProcessor.java:209) [java] at com.google.gwt.inject.rebind.GinjectorGeneratorModule.configure(GinjectorGeneratorModule.java:59)
GUICE binding is supposed to be automatic, any idea how to fix it ?
Guice can not be used directly with GWT. You need to use GIN.
javax.inject is a dependency that needs to be in your classpath.
If you downloaded Guice from Google, there should be a lib folder in the exploded zip with a javax.inject.jar file, or you can download it direct from trunk.
The key is this line:
[java] 1) No implementation for javax.inject.Provider was bound.
There are two things I can think of. First of all make sure you have properly inherited the GIN module in your GWT module xml:
<module>
...
<inherits name="com.google.gwt.inject.Inject"/>
...
</module>
Secondly you have to be carefull about versions of GIN and Guice. On the GIN homepage it says:
GIN 1.0 requires ... and Guice 2.0
For Gin 1.5 you'll need to use the Guice snapshot distributed with Gin or ... Guice 3.0
So make sure you have the appropriate Guice JAR in path.
精彩评论