GWT - including source files outside the module package hierarchy

I have a GWT project in eclipse with the following structure for a GWT module

com.foo.gwt -> Dashboard.gwt.xml com.foo.gwt.client com.foo.gwt.server 

I have different packages com.bar.baz1 , com.bar.baz2 , etc., the contents of which I want to include in the client code. All files are compatible with GWT JAVA-> JS.

The problem is that the <source> tag in Dashboard.gwt.xml interprets the path relative to the Dashboard.gwt.xml directory. Therefore, I cannot refer to anything outside the com.foo.gwt hierarchy.

So, I created a new module MyNewModule.gwt.xml in com.bar and included the baz1 and baz2 using the relative paths in the tag. Finally, I made Dashboard.gwt.xml to inherit the new module.

This works fine when compiling a Dashboard module, but it fails when compiling MyNewModule. This is because some classes in the reference classes of the MyNewModule of the Dashboard module.

I tried to inherit the Dashboard module in MyNewModule. This creates a circular link, but GWT does not complain about it. Everything works, but I don't like the circular link. I don't need MyNewModule, all I need is a way to include code from packages outside the hierarchy of the Dashboard module.

I wonder why the GWT does not allow absolute source paths.

Did I miss something?

+4
source share
1 answer

You do not need to compile each module separately. When you compile your com.foo.gwt project, the GWT compiler will look for all the dependencies in your com.foo.gwt.xml file and will compile ALL .java files for both your com.foo and com.bar.baz. (and other libraries) in javascript.

As you said, correctly place MyNewModule.gwt.xml in the com.bar.baz project and "inherit" it in the DashBoard.gwt.xml file. The part that you are missing is to create a .jar file with the MyNewModule project and place it in the war / WEB-INF / lib folder (only the gwt.xml file and compiled Java classes).

+2
source

All Articles