tbroyer / gwt-maven-plugin

Starting fresh on building GWT projects with Maven
https://tbroyer.github.io/gwt-maven-plugin/
Apache License 2.0
167 stars 39 forks source link

Question: Codeserver dependency problem when using multiple GWT modules #137

Closed tbuckel closed 3 years ago

tbuckel commented 4 years ago

Hi, not sure if I'm doing something wrong. I'm trying to build a proof-of-concept for migrating a GWT to the "Turducken" pattern, i.e. split the existing app into multiple GWT modules, also for later re-use/replace with a different UI framework.

I've used the modular-requestfactory archetype and create my project. Then I've added multiple, independent GWT modules:

Navigation Module and Module 1 use elemental2, Module 2 doesn't.

When starting the codeserver through mvn gwt:codeserver -am all modules are loaded, however if Module 2 is loaded, an error is reported that Module 2 cannot be compiled:

[INFO] Super Dev Mode starting up
[INFO]    workDir: /XXXX/target/gwt/codeserver
[WARNING] 2020-04-22 16:54:45.125:INFO::main: Logging initialized @863ms
[INFO]    Loading Java files in com.xxxx.frame.Portal.
[INFO]    Module setup completed in 2095 ms
[INFO]    Loading Java files in com.xxxx.refdata.PortalRefDataAdmin.
[INFO]    Module setup completed in 641 ms
[INFO]    Loading Java files in com.xxxx.templates.PortalTemplateEditor.
[INFO]    Tracing compile failure path for type 'com.xxxx.frame.client.Portal'
[INFO]       [ERROR] Errors in 'file:/xxxx/Portal.java'           
[INFO]          [ERROR] Line 45: No source code is available for type elemental2.dom.DomGlobal; did you forget to inherit a required module?
[INFO]    Module setup completed in 566 ms

In the above, it looks like it tries to compile Portal.java (which is the entrypoint of the Portal module) when it compiles PortalTemplateEditor, i.e. a file which isn't even part of the PortalTemplateEditor module.

Anything I'm doing wrong?

Thanks, Thomas

PS: I looked at #109 and #90 but don't see how they would be applicable PPS: As it's a PoC at this stage, I can provide the full source code.

tbuckel commented 3 years ago

@tbroyer Wondering if you could have a look at this. Most likely something in my config is wrong. Is there a sample project with multiple gwt-app packaged Maven modules anywhere?

tbroyer commented 3 years ago

Could it be that you are sharing the same package/subpackage between projects?

There's no gwt-app isolation with SDM when using it with multiple modules/projects at once, contrary to gwt:compile for instance.

If com.xxxx.frame.client.Portal is in the client-path of Module 2 (or one of its dependencies), then GWT will check it when compiling Module 2.

Solutions are:

tbuckel commented 3 years ago

Thanks for looking into this @tbroyer .

There are overlaps in the client-paths and I will first see to eliminate them. Thanks for the other options, I'll give these a try over the next days.

Are you aware of any (sample) Maven setups which use multiple GWT module to implement the old "GWT Turducken" pattern, i.e. multiple independent GWT modules?