Whether or not you "need" to separate into client/server/shared is really 
up to your team and your requirements. I would nearly always advise doing 
it, given the choice, but "need" is perhaps a little strong.

The linked https://github.com/xlavs/gwt-maven-archetype/ project doesn't 
appear to actually be broken up into separate classpaths, just separate 
packages. Again, given the choice, I would go further than this, breaking 
into separate projects, to isolate the client and server classpaths from 
one another. If you're putting effort into this, consider going a step 
further, and consider the "modular-webapp" archetype at 
https://github.com/tbroyer/gwt-maven-archetypes/ as a potential starting 
point. Besides being quite a bit newer (and supporting running on Java 11, 
etc), it also uses a better supported GWT maven plugin.

Separating your client/server/shared is almost always easier than it seems 
- after all, your JVM cannot run actual client code, and GWT+browser cannot 
run actual server code. The gray area is the code that both JVM and 
gwt+browser may be able to use many of your classes - especially beans that 
can be serialized over GWT-RPC. For projects with a long history, the lines 
often blur further, but the blurring is usually more to do with how many 
classes there are rather than how much actual overlap there is.

Your .gwt.xml file either has <source> tags in it, or uses the default of 
the "client" package. That alone will narrow things down - anything outside 
of those packages is exclusively "server", and anything in the GWT source 
packages is either "client" or "shared". Make that first cut, moving 
server-only code to one module, and either put everything else in "shared", 
or try to find a pretty clear divide of "probably-client" and "everything 
else" to put in shared. Get that to compile and run, and then work out 
where the lines really lies.

Another tool you have is the "-strict" or "-failOnError" flag to pass to 
the GWT compiler. That tells the compiler to fail if code doesn't compile, 
indicating that it either is actually server-only, or just dead code that 
can be removed.





On Wednesday, February 5, 2025 at 6:25:44 PM UTC-6 jiny...@gmail.com wrote:

> Hello,
>
> We have a big GWT project with following configurations that needs to be 
> converted to a Maven  project. 
>
> GWT2.9
> JDK11
> Eclipse 4.24
> Tomcat 9
>
> We have changed our project by applying the Maven folder structure as 
> below, however, we're not sure if we need to separate the java files to 
> Client/Server/Shared folders or not.
>
> src/main/java -> java sources
> src/main/resources -> resources: .properties files, .xml files, ...
> src/test/java -> test java sources
> src/test/resources -> test resources
>
> According to the project structure specified by the following gwt maven 
> archetype,  we need to move our java files by using this approach, is it 
> correct? In other words, what is the best way to determine which files need 
> to be put in the Client/Server/Shared folders?
>
> https://github.com/xlavs/gwt-maven-archetype
>
>
> Client folder:
>
> /**
>  * The client-side stub for the RPC service.
>  */
> @RemoteServiceRelativePath("greet")
> public interface GreetingService extends RemoteService {
>     String greetServer(String name) throws IllegalArgumentException;
> }
>
>  * The async counterpart of <code>GreetingService</code>.
>  */
> public interface GreetingServiceAsync {
>     void greetServer(String input, AsyncCallback<String> callback)
>             throws IllegalArgumentException;
> }
>
>
> Service folder: 
>
>  * The server-side implementation of the RPC service.
>  */
> @SuppressWarnings("serial")
> public class GreetingServiceImpl extends RemoteServiceServlet implements
>         GreetingService {
>
>
> As our project is a large one with many packages without clear separation, 
> what is the best way to convert it to Maven project with proper structure 
> in a timely manner? I read some posts suggesting to use a multi-module 
> project structures for a big Maven project. Is it the right way to go? Or 
> we have a simple way to convert it as we don't have much maven experiences 
> for the multi-module project. 
>
>
> Your help is much appreciated!
>
> Jenny
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/google-web-toolkit/1b666e16-5461-43ad-a2e7-03fb6b0a5413n%40googlegroups.com.

Reply via email to