Friday, February 2, 2018

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

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

Le jeudi 1 février 2018 18:56:20 UTC+1, Thomas Broyer a écrit :


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"

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment