GWT: Is it possible to refer non-GWT modules that contain GWT-independent presenters?

140 views Asked by At

For curiosity's sake, I'm developing a small experimental platform/environment-agnostic MVP framework-like thing that's supposed to be as much platform independent as possible. Currently it consists of dumb models, platform-independent presenters (defined in a single abstract main application module), and platform-dependent views (currently there are experiments with Swing, Android and terminal-friendly environment). However, I'm in trouble trying to make GWT another available platform because it requires modules inheritance via .gwt.xml files. Is there a good way of inheriting non-GWT modules somehow, and keep that abstract platform-independent module .gwt.xml-free, but still available for the GWT? If it's worthy: all modules are built with Maven, and the project structure is as follows:

[root]
    [app]                --- platform-independent application
        pom.xml              -- references fx
    [app-gwt]            --- GWT-views, entry point, etc
        pom.xml              --- references app, fx, fx-gwt
        .... App.gwt.xml     --- references Fx.gwt.xml
    [fx]                 --- the core itself
        pom.xml              --- references nothing
    [fx-gwt]             --- GWT-specific adapters for the fx module
        pom.xml              --- references fx
        .... Fx.gwt.xml      --- references GWT core
    pom.xml

Simply speaking, I don't want either app or fx to be GWT-related in any case. Also, I thought that modifying <source path="..."> (referencing to another module source code) can help, but I can't make it work (if it's possible). Here are some similar questions, not sure they can help:

Thanks.

(For simplicity, let's assume that app and fx have no external dependencies)

1

There are 1 answers

0
Lyubomyr Shaydariv On BEST ANSWER

I've investigated the problem deeper, and the general solution is:

  • Supply the dependencies source code to the dependency repository using the maven-source-plugin plugin. This step is a must because GWT compiles the dependency source code rather than using JAR.
  • Define a regular GWT module with inherit elements to make dependencies.
  • Compile the target application using gwt-maven-plugin with the compileSourcesArtifacts configuration option set to match the dependencies.

See more at http://mojo.codehaus.org/gwt-maven-plugin/user-guide/library.html