Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"New Project" action etc should avoid mixing server and client code #437

Open
niloc132 opened this issue Feb 2, 2023 · 6 comments
Open

Comments

@niloc132
Copy link
Member

niloc132 commented Feb 2, 2023

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.

@foal
Copy link
Contributor

foal commented Feb 2, 2023

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.

@keinhaar
Copy link
Contributor

keinhaar commented Feb 3, 2023

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.

@protoism
Copy link
Contributor

protoism commented Feb 8, 2023

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

@niloc132
Copy link
Member Author

niloc132 commented Feb 8, 2023

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?

@keinhaar
Copy link
Contributor

keinhaar commented Feb 8, 2023

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.

@niloc132
Copy link
Member Author

niloc132 commented Feb 8, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants