4

I don't remember where I've red that, for gwt 2.7.0 sdk maven module must consist of 3 submodules: server, shared and client.

But on github I've seen different projects for 2.7

Can any one can answer me this question?

masterdany88
  • 5,041
  • 11
  • 58
  • 132
  • 1
    No you do not have to create multiple modules. It can be helpful if you want to make your code more modular. I can tell you from experience that it makes development much more cumbersome when developing the application. This is due to making a change in the shared module and the client code doesn't see the change. I would recommend starting with a single project and having your server/shared code in the same project until it makes sense to move the code to it's own module. – Chris Hinshaw Aug 27 '15 at 21:31
  • I've red that client code cannot be compiled to the same directory that server code will be. And I ask definitely for version 2.7.0. So are You sure Your answer? – masterdany88 Aug 28 '15 at 07:06
  • 1
    This is correct but you don't have to put your code in multiple modules. You cannot include non white-listed classes in the client package. GWT uses the convention of .client and .server to separate the server side code from the client side code. This is only for the gwt compiler because it will only compile the code in the .client.* package and leave not the .server package. The gwt compiler can use the code in the .server package as long it is something like simple DTOs. It wouldn't be able to compile classes that do for instance file io. – Chris Hinshaw Aug 28 '15 at 13:41

1 Answers1

1
  1. Code in server - runs in servlet container (for example access to DB)
  2. Code in shared - can be used in client and in server codebase (for example DTOs - data transfer objects)
  3. Code in client - will be compiled to JavaScript and runs in browser

So you must decide yourself how much modules you need. If you code is a simple widget that does not communicate with server, you need only client module