1

I have a multi-module GWT project with the following approach, but I am having trouble running it in dev mode.

Here is the structure of the POM files.

Parent POM

<project>
    <groupId>com.mycmp</groupId>
    <artifactId>com.mycmp.xt</artifactId>
    <version>1.0.0</version>
    <packaging>pom</packaging>
    <modules>
        <module>../com.mycmp.xt.dm</module>
        <module>../com.mycmp.xt.pc</module>
        <module>../com.mycmp.xt.re</module>
        <module>../com.mycmp.xt.rev</module>
        <module>../com.mycmp.xt.webapp</module>
        <module>../com.mycmp.xt.services</module>
    </modules>
    <dependencies>
    </dependencies>
    <build>
        <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>gwt-maven-plugin</artifactId>
                <version>2.5.1</version>
        </plugin>
    </build>
</project>

From the modules,

  • xt.dm is a shared GWT module and so I have it as JAR package.
  • xt.pc is one GUI GWT module (only GUI code, all the RPC code lives in the web app module)
  • xt.re is another GUI GWT module (same as xt.pc)
  • xt.rev is another GUI GWT module (same as xt.rev)
  • xt.services is our server side services layer (JAR package)
  • xt.webapp is our web app (where web.xml and appcontext.xml and so on are located) (WAR package)

I am thinking about the following questions:

  • Is this the right approach?

  • How would I package all this to run from a single Tomcat instance?

  • How would I run per say xt.pc in dev mode? (I tried marking the runTarget under the xt.pc pom.xml, but it didnt work. I think the conflict is in merging the xt.webapp and xt.pc (they both have GWT code).

Sebastian Zartner
  • 18,808
  • 10
  • 90
  • 132
Kathir
  • 6,136
  • 8
  • 36
  • 67
  • 1
    Sorry, no time to write full answer but here's my take on GWT and Maven (using multi-module builds): https://github.com/tbroyer/gwt-maven-archetypes (announcement: http://blog.ltgt.net/announcing-gwt-maven-archetypes-project/ ) – Thomas Broyer Jun 25 '13 at 09:11
  • @ThomasBroyer I believe I made a good progress with that. But when i run the client module with gwt:run -Ddev. It opens up the gwt development mode.Now What is the right url to access the application. The client pom has http://localhost:8080 without any module html associated. I also get a warning as "[WARNING] Your POM does not match your hosted webapp WEB-INF/classes folder for GWT Hosted browser to see your classes.". When i access the url i get 404 – Kathir Jun 26 '13 at 00:02
  • @ThomasBroyer esp. i dont understand what this means in the client pom file. http://localhost:8080/ – Kathir Jun 26 '13 at 18:00
  • If you change the port for Tomcat or Jetty on the *-server module, keep that property synchronized; similarly if you add a path prefix. Replying to your other issue [on the group](https://groups.google.com/d/topic/google-web-toolkit/r7IIHD412uo) – Thomas Broyer Jun 26 '13 at 22:37
  • Yes....that did the trick. I had to change the port to 8085, there was something else running on 8080 which led to 404. Thanks @ThomasBroyer – Kathir Jun 27 '13 at 05:10

1 Answers1

1

To the third question: When making modules keep in mind that resources you provide from different modules are not attached from the files inside your modules, but from their jar's. So when you use code in your gui application from another module and you change code inside that module you will need to recompile that module, as dev mode will compile on the run code from jar's and from source code of the project you have started using dev mode.

For instance: you have parent module named A. This parent module contains two modules B and C. In C you have some common classes. In B you have implemented the entire gui with entry point. Also in pom of module B you have added gwt-maven-plugin in build section. When you start your project from module B in Dev mode any changes you make inside your B module will be reflected on webpage when you refresh your webpage. However if you modify any classes inside module C, those changes will not be visible until you restart the dev mode and after you rebuilt module C. This is because refreshing the webpage does not rebuilt the modules that are dependencies.

However I do not know how dev mode will behave when you would start it from parent pom after u specify module in the configuration tag of gwt-maven-plugin.

Kaszaq
  • 997
  • 10
  • 16
  • 1
    Note: this is only true if you have `package` in the same _build_ as `gwt:run`, otherwise Maven will pick the `target/classes` of dependent modules. – Thomas Broyer Jun 26 '13 at 10:14
  • GWT dev mode is not really prepared for multi-modules development. These two pages address this question, but the outcome is that everything works as if it were a single module (the war module adds the src directories of the other modules as one of its own sources): http://mojo.codehaus.org/gwt-maven-plugin/user-guide/multiproject.html http://mojo.codehaus.org/gwt-maven-plugin/user-guide/productivity.html In fact those pages could be merged into a single one, and for this reason I have opened this issue: http://jira.codehaus.org/browse/MGWT-380 – Constantino Cronemberger Sep 27 '14 at 19:38