Description
I have a Parent GWT project that uses the gwt-maven-plugin. This project is split into 2 sub-projects: Domain and WebApp and each project contains pom.xml files. I'd like to split the domain code from GWT client code.
Parent project
- /Parent
- /Parent/pom.xml
Domain project
[1] I think of of it as the server-side part of the application that runs on the server
- /Parent/Domain
- /Parent/Domain/pom.xml
- .../beans/PersonBean.java
- .../dao/PersonDAO.java
- .../services/PersonService.java
- .../util/DateUtil.java
- .../gwt/client/GWTPersonService.java
- .../gwt/server/GWTPersonServiceImpl.java
- .../gwt/shared/GWTPersonDTO.java -- a DTO(Data Transfer Object)
WebApp project
[2] I think of it as the client-side of the application that runs in the web browser.
- Parent/WebApp
- Parent/WebApp/pom.xml
- .../gwt/client/PersonUI.java
- .../gwt/util/GWTUtility.java - this is a utility class called by GWT components, it is not used on the server
- .../webapp/WEB-INF/web.xml
- .../webapp/Page.css
- .../webapp/Page.html
Sequence diagram

PersonUI will call GWTPersonService's methods which calls PersonService(I need this separation because PersonService.java will be called by non-GWT clients as well).
PersonService will call PersonDAO which uses and returns PersonBean instances. Then, PersonBean gets converted to GWTPersonDTO and sent to the client by GWTPersonServiceImpl.
Questions (edited)
- In which project should I put the shared GWT code that normally lives under /shared folder?
- Does it make sense to have GWTPersonServiceImpl.java and GWTPersonService.java in the domain project? My reason is that since all servlets live on the server, and the domain is for server-side then those classes should be in the Domain project.
- Should I move GWTUtility.java inside Domain project?
- Does it make sense to use DTO's? Is there any way to make it more straight-forward: i.e. use directly the PersonBean?
- Is it possible to run this scenario in GWT Developer mode using maven? How easy is it to configure?
- If you have any modifications/additions to the above scenario, please post them - or even better if you have already done an app it would help much to know how you did to solve this separation.
Thank you!