I was finally able to get this working in hosted mode again but I'm not exactly sure why. All the evidence points to a bug in IntelliJ as the fix involved deleting the IntelliJ project files and rebuilding from the Maven pom files and messing with the JDK version both specified in the Maven pom files and in IntelliJ.
I've seen cases before where IntelliJ gets confused by the Maven project and just looses dependencies, but that did not seem to be occurring in this case. Also IntelliJ does not handle well cases where, in a multi-module build, modules use more than one JDK version. And that is my case due to GWT not supporting JDK7 yet.
That being said...it's possible that I don't have the JDK version specified properly in my Maven pom files. I'd like to know how best to configure the JDK in the Maven build when using GWT. Here is my use case:
I have a multi-module build where my runtime JDK has to be 7.0. In addition I have lots of dependencies that were built with JDK7 so I have to use that as my main compiler for my build. In my maven project I have one child folder that handles all the GWT parts of the build. That GWT parent folder has the following 3 modules:
myapp-gwt-api
- Module that contains shared code between myapp-gwt-dev & both the client and server portion of myapp-gwt-war
- This module is of type pom but it generates a jar. I presume this was made a pom type to give full control over what goes in the jar, the build is configured to compile and then include both the classes and the java source in the jar. However in this build the JDK version is not specified in the maven-compiler-plugin configuration...so I guess it uses some default? In retrospect it seems the classes could use JDK7 as that is what all the server side code uses but the java source has to be JDK6 compatible else the GWT compiler won't be able to use the source.
myapp-gwt-dev
- Module that contains GWT rebind code. Our project makes heavy use of GWT's rebind code generation feature so all the code that is needed to rebind/generate code is in this module.
- This module has a dependency on myapp-gwt-api
- This module is of type pom but generates a jar. This module appears to be just like the previous one...it generates a jar with both classes and source files.
- Also this module gets the GWT compiler classes from the gwt-dev jar and puts them in this module. I presume this is so that in the next module GWT has all that it needs to perform the GWT rebind operation without having to add a dependency on gwt-dev in the war module. Also it would serve as a way to keep the rebind code out of the war...as that is not needed at runtime.
myapp-gwt-war
- This is the main GWT module and is of type war.
- It has a dependency on myapp-gwt-api and on myapp-gwt-dev however in the later case it has provided scope to stop it from going into the wars runtime dependencies.
- This module uses gwt-maven-plugin to compile the GWT application, however the JDK version is not specified so I assume that uses a GWT default?
- In this module, in the maven-compiler-plugin, we do specify the JDK version, it's set to 1.6 for both source & target. I'm not clear what this should be. Ideally we would want the source & target to be 1.7 for the server side code. However the client side source has to be 1.6 for GWT. And does this setting affect what compiler is used by the gwt-maven-plugin, or is that completely separate?
Now that I get to the end of analysis of the Maven build I see that that the maven-compiler-plugin is configured in the pluginManagement section to use JDK 1.7 for both source & target. So I assume that where I said above the compiler version was not specified...it would use 1.7 as the defaults.
In retrospect it seems that for both myapp-gwt-api & myapp-gwt-dev we should use 1.6 for the source and 1.7 for the target in the maven-compiler-plugin config? I'm not sure about in myapp-gwt-war...maybe the same.
I'd really appreciate feedback on how best to configure this.
-Dave