gwt-eclipse-plugin
gwt-eclipse-plugin copied to clipboard
"New Project" action etc should avoid mixing server and client code
Projects with mixed client/server classpaths are helpful for tiny demos, but can cause many irritating surprises for large applications as the classpath grows. Additionally, with J2CL it will not make sense at all to mix these classpaths.
A decent analogy would be writing an Android application with the server code in the same source directory and classpath.
As such, any method to enable the GWT facet for a project should at least make it difficult to do so for an existing server project, unless the user acknowledges the risks.
BTW - 3 modules in each project
- server part (usually Spring Boot), may depends on any libraries and use any JDK
- client GWT part (compile to JS), depends only to GWT adopted Java libraries and JDK up to 11(?)
- shared GWT part (usually DTO and Interfaces for REST controllers). Contains shares Java classes between GWT and server part.
That's true, but it is good for new users to have an example application running in no time. Anybody with some experience will separate the parts for real world applications.
But... is it possible to creare a multi-project with "new project"? Probably a multi project build is feasible only with import commands (need to check). And if import is the way to go, probably maven / gradle projects are the correct thing to do
I'm suggesting we restrict the action to only create client code, and warn if enabling the gwt facet if servlet (or other server) facet is already enabled.
Like with legacy dev mode, we can still leave the old option as deprecated, and maybe warn that this only makes sense for very small examples?
Sorry, i don't see the benefit of spending time on this. It's just a sample application demonstrating the power of GWT. Why should we care about how users setup their projects? How many projects should be created instead? 2, 3 or even more? I think that's totally up to the user. At my company we are splitting the code into 7 separate projects.
Wouldn't it be better to provide some Documentation on different types of project setups on the GWT Site? That could include maven and/or gradle setups, as well as how the maven-archetypes are used.
More docs is good, but plenty of people just use the tool, and if the tool makes it easy to do the wrong thing out of the box, and encourages doing the wrong thing in its examples, users will build on that. If we reduce the scope to "warn about configurations that will cause problems eventually" (probably with a "don't show me again"), this still achieves both goals, letting users willfully do it the wrong way, and introducing new users to the correct way?
This problem is going to get more pronounced over time, especially as jakarta.servlet becomes the expected way to write servlets, while GWT still keeps Java 8 (and so Jetty 9, and so javax.servlet) support.