Hello All, I had a largish Web app with several GWT modules in different packages. These modules shared common code which I put into a separate module, also in it's own package. As simple as I can describe it, it looked a bit like this:
// Modules specific to the app: MyPackage.MyApp.GWTModuleA MyPackage.MyApp.GWTModuleB MyPackage.MyApp.GWTModuleC // A common module that could be used in other apps: MyPackage.common.GWTModuleD // Common module containing code and resources used by any GWT module: MyPackage.common.gwt.Common Each of these modules contained their own module XML file (of course), CSS file, HTML file and images. Each module, even the Common one, had it's own entry point. Each module defined at least one servlet -- which were all also configured in the app's web.xml file. The Common module included an entry for <add-linker name="xs" />. All of the modules, A through D, inherited the Common module. For example, GWTModuleA could use styles defined in Common's common.css file, as well as inheriting widget classes. When I complied everything (using IntelliJ IDEA), the output from compiling normal Java source into class files and compiling GWT Java source into JavaScript all were put into one folder where a WAR file was also built. The relevant folders in the output were: // Normal class files into the usual places: WEB-INF/classes/MyPackage.MyApp.SubPackageA/*.class WEB-INF/classes/MyPackage.MyApp.SubPackageB/*.class etc. // GWT JavaScript and resource files: MyPackage.MyApp.GWTModuleA/*.js MyPackage.MyApp.GWTModuleA/*.rpc MyPackage.MyApp.GWTModuleA/*.png MyPackage.MyApp.GWTModuleA/images/ -- From the Common module MyPackage.MyApp.GWTModuleA/common.css -- From the Common module MyPackage.MyApp.GWTModuleA/GWTModuleA.css MyPackage.MyApp.GWTModuleA/GWTModuleA.html (and similarly for modules B, C and D *and* Common) This all went together very nicely and worked and SO FAR SO GOOD! Then I proceeded to break it :-) I wanted to put my Common module into it's own JAR file so that my Web app and other Web apps we are developing could use it. Here's what I did (amongst several things that didn't work, and trying to cut the long story short...): 1) I created a new "Common" Intellij IDEA project and moved my common modules, MyPackage.common.GWTModuleD and MyPackage.common.gwt.Common, from my Web app project into it. 2) In the "Common" project, I compiled everything. The normal Java class files went into their respective folders, i.e.: // Regular Java classes: MyPackage/common/SubPackageA/*.class MyPackage/common/SubPackageB/*.class // GWT modules, their classes and resources, i.e., CSS, HTML, etc. and the module XML file: MyPackage.common.GWTModuleD/* MyPackage.common.gwt.Common/* and GWT's JavaScript output, all went into a separate folder (let's say I don't need this for now). NOTE: During the compilation of the GWT class files, I was *also* careful to copy their Java source files into the same folders (a requirement when building JAR files for shared GWT modules). 3) I created a JAR file from the classes, sources and resource files in step #2. 4) I imported this new JAR file into my original Web app project, now sans all the common code I moved into the new "Common" project. 5) I successfully compiled my Web app project and deployed the resulting WAR file as before. The Web app appeared to work, *except* in my GWT modules, that used common code before, were all missing the styling and images from my Common module. Also, the GWTModuleD common module was not there at all. So, what did I do wrong? What am I missing? Here are my assumptions, of which some are presumably totally incorrect: a) When I compiled my Web app project with my Common GWT JAR file, GWT found the class files in the JAR and so any widgets I built in the Web app were inheriting the functionality of the common widget code. This did appear to happen without problem. b) When GWT was compiling my Web app GWT modules, it was using the source files to create the JavaScript files under their MyPackage.MyApp.GWTModule[ABC] folders, copying any resource files from their original location in the project. This also appeared to occur without a problem. c) When GWT was compiling my Web app GWT modules in the project I thought it should have seen they were inheriting my MyPackage.common.gwt.Common module in the imported JAR file. I thought it should have taken the source files from the JAR to create the JavaScript and copy the resource files from the JAR into a MyPackage.common.gwt.Common folder *and* copy files like CSS and images into the MyPackage.MyApp.GWTModule[ABC] folders of modules inheriting the Common module. This DID NOT happen. d) More problematic, perhaps, is that MyPackage.common.GWTModuleD was totally ignored, because I had no way of telling GWT to extract it's source and resource files from the JAR file to create the MyPackage.common.GWTModuleD folder with it's JavaScript and associated resource files. The only place the servlets in this module are referenced outside of itself is the Web app's web.xml. As you can see, (c) and (d) are where I need the help on. Any ideas of where I'm going wrong, or any extra steps I should take? Am I trying to do something that is currently impossible? Was I assuming too much of GWT? Many thanks in advance, and I do apologise for the length of this message. - Garry Archer --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
