Migrating from GWT 2.5.1 to 2.8.2 - Problem with Super dev mode

970 views
Skip to first unread message

Martones

unread,
Oct 31, 2017, 5:31:39 AM10/31/17
to GWT Users
Hey guys,

I'm trying to migrate my app which looks like this : 
GWT 2.5.1 front, PHP back, no maven -> GWT 2.8.2 front, PHP back, maven with gwt-maven-plugin.

I manage to mvn gwt:compile and mvn gwt:run-codeserver.

I actually think I'm confused about how the SDM runs now in 2.7+ but here is what I was thinking : 
  1. Run compile (optional ? ) via mvn gwt:compile
  2. Run code server via mvn gwt:run-codeserver
  3. Save the bookmarklet and compile via the popup on my gwt page 
  4. re-compile on every code change manually
The third point is the one that isn't working anymore (was ok in 2.5.1). In the popup I have :

mymodule : off This module doesn't have Super Dev Mode enabled.

Here is my module file: removed all the SDM lines that I understood are now useless, doesn't work anyway if I keep them :)


<module rename-to='mymodule'>
 
<!-- Inherits -->
       
<!-- ... -->

 
<!--  Entry point -->
 
<entry-point class="com.mycompany.mymodule.client.mymodule"></entry-point>

 
<!-- paths -->
 
<source path='client' />
 
<source path='shared' />

 
<!--  SDM  -->
 
<!-- <add-linker name="xsiframe"/>
 
  <set-configuration-property name="devModeRedirectEnabled" value="true"/>
 <set-property name="compiler.useSourceMaps" value="true"/> -->

 
 
<set-configuration-property name="CssResource.conversionMode"    value="strict" />
</module>


I'm serving my php page from a docker container on my localhost (so no HTTPS).

Any help is much appreciated :)

Ludovit

Thomas Broyer

unread,
Oct 31, 2017, 6:41:31 AM10/31/17
to GWT Users


On Tuesday, October 31, 2017 at 10:31:39 AM UTC+1, Martones wrote:
Hey guys,

I'm trying to migrate my app which looks like this : 
GWT 2.5.1 front, PHP back, no maven -> GWT 2.8.2 front, PHP back, maven with gwt-maven-plugin.

I manage to mvn gwt:compile and mvn gwt:run-codeserver.

I actually think I'm confused about how the SDM runs now in 2.7+ but here is what I was thinking : 
  1. Run compile (optional ? ) via mvn gwt:compile
  2. Run code server via mvn gwt:run-codeserver
  3. Save the bookmarklet and compile via the popup on my gwt page 
  4. re-compile on every code change manually

In 2.7+, you can do:
  1. Run code server with -launchDir pointing to the directory served by your server
(there's no other step, code server will automatically compile/recompile on page load)
With Mojo's plugin (you did notice the maintainer now “strongly encourage[s you] to use the new [plugin]” though, right? see https://gwt-maven-plugin.github.io/gwt-maven-plugin/ ), that's <launcherDir> and <webappDirectory>.

The only downside is that code server when run this way will overwrite the mymodule.nocache.js, so make sure you recompile the app before packaging/deploying (gwt-maven-plugin staleness check might be confused, so "mvn clean", or force recompilation with -Dgwt.compiler.force)

Martones

unread,
Oct 31, 2017, 11:53:07 AM10/31/17
to GWT Users
Hi Thomas,

Many thanks for your time and answer! I was indeed playing with the legacy plugin ... :)  Things work much better now. The super dev mode is really great by the way.

I used your plugin and revamped slightly the client project (moved my main mymodule.gwt.xml to /src/main/java/module.gwt.xml and all my sources to /src/main/java). I'm then running code server with launcherDir arg pointing to my php root.

As for the downside of overriding nocache.js, I think the ideal process of deploying is compiling within a CI chain so it won't matter at all :)

Many thanks again,

Ludovit

Martones

unread,
Feb 1, 2018, 12:11:51 PM2/1/18
to GWT Users
Hi everyone, and Thomas especially :p

I'm migrating a larger legacy project to the actual GWT standards. I'm running into many problems but I'm sure they are all due to my misunderstanding of how to wire modules between them. Here is the context and my questions : 

My old project structure was (GWT 2.5) : 

Shared: gwt project - pure clientside gwt
WebUI: gwt project, depending on Shared
MobileUI: gwt project, depending on Shared


New project (GWT 2.8.2) :

Right now I'm trying just to have WebUI working, so I'm inspiring from Thomas's gwt-maven-archetypes (modular webapp).

My architecture is :
  • root-project
    • pom.xml
      • shared
        • pom.xml
        • src/main/module.gwt.xml
      • web-client
        • pom.xml
        • src/main/module.gwt.xml
Questions
  • When I try to gwt:codeserver :
Loading Java files in (project shared).
[ERROR] Errors in 'file:(some client project file)'
No source code is available for type '(some file from shared project)' ; did you forget to inherit a required module?


Although I have these dependencies set in my client pom.xml :

<dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>shared</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>shared</artifactId>
      <version>${project.version}</version>
      <classifier>sources</classifier>
    </dependency>
I also added maven-source-plugin to both client and shared.
  • I have some old gwt .jar dependencies that do not seem to have any maven artifacts, how do I properly inherit these? I was thinking about <inherits> in module.gwt.xml and adding a <scope>system</scope> dependency in pom to link to the JAR.
  • I'm running codeserver in the root-project right now, is that ok even when I would like to serv my mobile sub-project ? (Using "modules" parameter I suppose)

Many thanks guys, I hope this is not too messy and that I didn't miss some obvious piece of info out there that solves all this out :)

Thomas Broyer

unread,
Feb 1, 2018, 12:56:20 PM2/1/18
to GWT Users


On Thursday, February 1, 2018 at 6:11:51 PM UTC+1, Martones wrote:
Hi everyone, and Thomas especially :p

I'm migrating a larger legacy project to the actual GWT standards. I'm running into many problems but I'm sure they are all due to my misunderstanding of how to wire modules between them. Here is the context and my questions : 

My old project structure was (GWT 2.5) : 

Shared: gwt project - pure clientside gwt
WebUI: gwt project, depending on Shared
MobileUI: gwt project, depending on Shared


New project (GWT 2.8.2) :

Right now I'm trying just to have WebUI working, so I'm inspiring from Thomas's gwt-maven-archetypes (modular webapp).

Beware, the "shared" in these archetypes is meant as "shared between client and server", where client+shared+server are seen as "a single application" but are split out due mostly due to how Maven works: client and shared use the same package, so there's no need for a gwt.xml in the shared library (for those who know about it, this is somehow similar to a Kotlin Multiplatform project).
In your case, the "shared" library is client-side only and shared between GWT applications. Not the same kind of "shared". I would use separate packages then, and the gwt-lib packaging (which comes with a gwt.xml for the library): replace <packaging>jar</packaging> with <packaging>gwt-lib</packaging> (or most likely add it), remove the maven-source-plugin, add the gwt-maven-plugin with a configured <moduleName>, and replace the dependencies to it in web-client and mobile-client to a single dependency with <type>gwt-lib</type>.
 
My architecture is :
  • root-project
    • pom.xml
      • shared
        • pom.xml
        • src/main/module.gwt.xml
      • web-client
        • pom.xml
        • src/main/module.gwt.xml
Questions
  • When I try to gwt:codeserver :
Loading Java files in (project shared).
[ERROR] Errors in 'file:(some client project file)'
No source code is available for type '(some file from shared project)' ; did you forget to inherit a required module?



Do you have the gwt-maven-plugin in "shared" to process/rename that module.gwt.xml? Are you missing an <inherits/> to that shared module in your client's module.gwt.xml?
 
Although I have these dependencies set in my client pom.xml :

<dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>shared</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>shared</artifactId>
      <version>${project.version}</version>
      <classifier>sources</classifier>
    </dependency>
I also added maven-source-plugin to both client and shared.
  • I have some old gwt .jar dependencies that do not seem to have any maven artifacts, how do I properly inherit these? I was thinking about <inherits> in module.gwt.xml and adding a <scope>system</scope> dependency in pom to link to the JAR.

The <inherits/> is totally independent from your build tool, so if you needed it, you still need it.
I would recommend publishing the JARs to a Maven repository and use standard dependencies, but a system scope should just work. See https://www.cloudbees.com/blog/playing-trade-offs-maven
 
  • I'm running codeserver in the root-project right now, is that ok even when I would like to serv my mobile sub-project ? (Using "modules" parameter I suppose)

Yes. codeserver would then serve both apps by default, unless you "filter" them using the "projects" or "modules" parameter, or just Maven's "-pl mobile-client -am"

Martones

unread,
Feb 2, 2018, 11:39:37 AM2/2/18
to GWT Users
Many thanks Thomas, your help is very appreciated and very helpful as usual. 

I followed your advice and managed to get it working. I ended making a simple poc project similar to mine and adapted it to the original App. I uploaded it here if this can help anyone: https://github.com/lmartones/gwt-modular-app-example.

Although I face a new problem with the codeserver now: It runs on my http://127.0.0.1:9876/ , and I'm using "launcherDir" to put the output into a folder served by the remote server (I know this sucks but can't really run this otherwise). So I have the "web-client" correctly output on the server. But when I load the app in the browser, it searches the codeserver on the remote server and fails : 

Couldn't load client from Super Dev Mode server at http://remote-server:9876.

What is the right way of doing this please? 

Many thanks again,

Ludovit

Martones

unread,
Feb 2, 2018, 4:37:12 PM2/2/18
to GWT Users
From what I'm reading on github and gwt project it seems that for this use case I can only use dev mode. I'll try to do this and will make an update here.

Ludovit

Thomas Broyer

unread,
Feb 3, 2018, 10:15:09 AM2/3/18
to GWT Users
You can also use Super Dev Mode with bookmarklets (without -launcherDir), or setup a reverse proxy.

Martones

unread,
Feb 3, 2018, 3:58:33 PM2/3/18
to GWT Users
Oh alright, I really was messing things, thinking the previous bookmarklet methods were not working anymore. This suits me well and works perfectly! 

Although I'm not sure I understand how is the compilation / packaging supposed to work now. To generate my client files, I shall use gwt:compile (output to deploy dir)? If so I did not manage to do so invoking it on my root-project or web-client. On root project, when I use gwt:compile with no args, it requires me to define a GWT module, which is not the case. If I use -pl web-client -am it fails missing shared. And it fails similarly when I invoke it inside web-client.

So I only managed to do this running mvn install on root-project so far. Is there a better way, please ? :)

Many thanks again, this is starting to work!

Ludovit

Thomas Broyer

unread,
Feb 3, 2018, 4:45:59 PM2/3/18
to GWT Users
mvn prepare-package -pl web-client -am -DskipTests ? (you don't just want to gwt:compile, you want to compile the shared module, process ressources, compile the web-client module, and gwt:compile it)

Martones

unread,
Feb 4, 2018, 12:51:50 PM2/4/18
to GWT Users
All right many thanks. Oddly enough I have errors while mvn prepare-package, I don't have these when I mvn install or codeserver. 

[INFO] Compiling module com.test.WebClient
[INFO]    Tracing compile failure path for type 'com.test.client.token.PanelFilterLotToken'
[INFO]       [ERROR] Errors in 'file:/C:/workspace/test/web-client/src/main/java/com/test/client/token/PanelFilterLotToken.java'
[INFO]          [ERROR] Line 28: No source code is available for type com.test.token.controler.LotsManager; did you forget to inherit a required module?
[INFO]    Tracing compile failure path for type 'com.test.client.util.TimerUtil'
[INFO]       [ERROR] Errors in 'file:/C:/workspace/test/web-client/src/main/java/com/test/client/util/TimerUtil.java'
[INFO]          [ERROR] Line 34: No source code is available for type com.test.dao.IDAO; did you forget to inherit a required module?lat

Martones

unread,
Feb 4, 2018, 3:01:37 PM2/4/18
to GWT Users
I'm sorry I went a bit too fast on the last e-mail. So just to precise: the problem is while copiling web-client the source code from shared are not available.  (i'm inoking mvn on the root as usual)

Many thanks again !

Ludovit

Thomas Broyer

unread,
Feb 4, 2018, 4:43:57 PM2/4/18
to GWT Users
Try package instead of prepare-package then (my bad, you should never use a phase earlier than package in a multi-module Maven project, as a rule if thumb --there are few exceptions, as always, depends on the project though)

Martones

unread,
Feb 5, 2018, 3:43:09 AM2/5/18
to GWT Users
Yes it works with package! :)  Great, once more thanks a lot Thomas!

I hope this is the last point, but I didnt manage to include a "standalone" jar. I think I might as well try to find some up to date solution (not sure the legacy code will be GWT 2.8 compliant). But I admit I would at least like to understand how to I include a system scope jar.

I added a system scope dependency, added inherits and I still have "can not find Module.gwt.xml" :

In shared I added, <inherits> and the dependency below (I suppose groupId, artifactId and version are arbitrary in this case).
<dependency>
        <groupId>com.reveregroup.gwt</groupId>
        <artifactId>gwt-image-loader</artifactId>
        <version>1.1.4</version>
        <scope>system</scope>
        <systemPath>${basedir}/war/WEB-INF/lib/gwt-image-loader-1.1.4.jar</systemPath>
    </dependency>

Error : 

 [ERROR] Unable to find 'com/reveregroup/gwt/imagepreloader/ImagePreloader.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?


Ludovit

Thomas Broyer

unread,
Feb 5, 2018, 5:23:01 AM2/5/18
to GWT Users
According to https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html, the system scope is similar to the provided one, so it's not transitive and must be added to the web-client and mobile-client modules as well.
(also note that this page says the system scope is deprecated; you're encouraged to publish them to a Maven repository manager, or have each developer install them to their local Maven repo, or declare a repository in your POM with a file:///${basedir}/… URL (see https://www.cloudbees.com/blog/playing-trade-offs-maven that I shared above already; formatting is broken and you'll have to view the source to read the XML snippets, but it's mostly readable)

Martones

unread,
Feb 5, 2018, 5:30:19 AM2/5/18
to GWT Users
All right thank you Thomas, I will try one of these solutions! 

Ludovit
Reply all
Reply to author
Forward
0 new messages