GWT, dependent projects, GWT Compiling, and deploying

Skip to first unread message


Oct 31, 2012, 12:35:38 PM10/31/12

I'm not sure how exactly this is supposed to be accomplished, but...

I have a GWT project that has no Entry Point.  It is basically a number of classes, etc., that will be shared among different projects.  A "common" library, if you will.

And, I have a project that I'm actually working on, that depends on the Common project.

I am using GWT 2.4, and am developing through Eclipse.

Now, when I run in debug mode, everything works fine.

At this point, though, I want to perform a GWT compile through Eclipse, and then I have a build.xml that will grab the files from the war directory, and create a .war file.

Unfortunately, when I put together the .war file and deploy it on my Apache server, I notice an exception that a class couldn't be found - it's one of the classes from the Common project.

1) Does the GWT compile, when compiling and writing the various files to war/(myprojectname), war/deploy, etc etc actually compile the code from the Common project and put it in here as well?
   1a) If so, then why am I getting the exception?
   1b) If not, then how do I correctly compile the Common project (since it has no entry point) and include it in my main project?

Thanks.  I get the feeling I'm missing something right in front of my face, but can't figure out what it is.


Oct 31, 2012, 1:05:27 PM10/31/12
I also have a "app" and a "common" project in Eclipse. Both are GWT enabled projects and "app" has "common" as a project dependency. Also the app.gwt.xml GWT module inherits common.gwt.xml.

When you compile "app" using the GWT compiler it will compile everything it sees starting from the module you compile. So if you compile "app" and it inherits "common" then "common" will be compiled to JavaScript as well and everything ends up in app-project/war/app. So as long as everything compiles without error, everything should be fine :)

If the common project also contains server side code, then you have to copy these server side classes to your .war file. So your build.xml file should include app-project/war/WEB-INF/classes AND common-project/bin (or common-project/war/WEB-INF/classes depending on your project setup) when building the war file. Otherwise your common server classes will be missing in the war file as Eclipse compiles the project's source to the classes folder of the corresponding project.

If you see a NoClassDefFoundException then you are missing server classes and you should fix your build.xml.

-- J.


Oct 31, 2012, 2:54:04 PM10/31/12

Thanks for your reply - my issue was related to what you suggested - it turns out that my Common project has no server classes, but a number of classes in the shared package, which are extended by classes in the main project's shared package, which those in turn are used by the main project's server classes.

Ultimately, though, including copying the common-project/war/WEB-INF/classes directory into the .war file was the solution.  Thank you!

- Joe
Reply all
Reply to author
0 new messages