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

gwt-dev contains common java classes (like org.w3c.dom), causing conflicts #10095

Open
butlnor opened this issue Feb 19, 2025 · 6 comments
Open

Comments

@butlnor
Copy link

butlnor commented Feb 19, 2025

I don't know the reasons why "gwt-dev.jar" contains a lot of "garbage", like the whole "org.w3c.dom", which causes conflict with Java 9+, since DOM is already present in JRE, and Java 9+ module system doesn't allow same packages in different JAR files.

Please make sure that gwt-dev.jar is build without such common libraries! It is completely wrong to pack stuff, that is already present elsewhere. Currently, I will have to strip those classes out of JAR file, but this means I will have a modified custom JAR file, so it will not work with other team members (unless we all use the same modified JAR).

@tbroyer
Copy link
Member

tbroyer commented Feb 19, 2025

Get the JARs from the Central Repository, they don't contain those classes. The JARs from the ZIP distribution are designed to be "easy to use" from simple scripts (including Ant without Ivy), so you don't have to list too many files in your classpath (also, I don't think GWT works with the module path / JPMS, but AFAIK even those fat jars work with Java 9+ as long as you only use the classpath).

@butlnor
Copy link
Author

butlnor commented Feb 19, 2025

Hm, in Maven central repo, there is really a smaller file. But this is chaotic, having two different JAR files. Shoudn't it then be better to name the first one as "gwt-dev-full.jar"?

I understand, that sometimes it's better to include some 3rd party stuff, to simplify the building, but NOT including the common stuff like org.w3c.dom, which is already included in every JRE! It's ok to include things like Apache commons or similar, but not JRE things.

@butlnor
Copy link
Author

butlnor commented Feb 19, 2025

Well, the one in central repo has too few classes... missing almost every 3rd party lib, so I have to add them manually.
I think the solution now it to use the JAR from ZIP, but remove all those wrong classes from it, that should never be there.

@niloc132
Copy link
Member

We can look into removing this, as GWT only supports Java 11+ at this time.

That said, you can you describe the problem that this is causing, how you're able to use the gwt-dev.jar with JPMS? I would be very surprised to find that gwt-dev.jar's classes work when loaded from JMPS, with or without these types present. Especially for these types, gwt-dev.jar would need java.xml explicitly as a module dependency to use as you describe?

If there's a concrete benefit it probably makes sense to overhaul with #10011, as that will need lots of testing to be sure that shaded/uber jars behave as expected in all supported use cases. Including other dependencies also causes problems, so I don't like how comfortable GWT has historically been with this either.

@butlnor
Copy link
Author

butlnor commented Feb 20, 2025

It was enough to strip out "org.w3c.dom". This seems to be the only problematic inclusion. Since JRE already contains those classes.

So, if you just omit org.w3c.dom, I think this will suffice.

@niloc132
Copy link
Member

So that we can add some semblance of testing to this use case, can you describe or demonstrate how you're running, and give details for the problem that is happening? If this is a requirement of the tool, we need to be able to verify that the fix works.

Also, can you be specific about how you've used this in the past - is this a new project, or are you just now updating from Java 8 so that this is becoming a new problem?

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

3 participants