Monday, March 12, 2018

Re: GWT with App Engine (standard) and maven?

Hey Thomas,

Thanks for your instant reply!
I've been thinking about Gradle (as I'm new to both) as well, but I need a bunch of Google tools (like Cloud Endpoints) which come with a Maven plugin.
So I thought it would be easier to go with Maven (?).

Thanks for the link to the sample app! 
It is using the outdated appengine plugin instead of the current appengine plugin using the gcloud tools from "com.google.cloud.tools", but probably I can use that as a starting point.

I really feel as a really dumb user right now, but is there a way to "checkout" the sample app in a simple way or do I have to clone the full repository or download each file individually?
Never used the Google git...

...and what do you mean by "make sure you have gwt-dev declared as a compile-time dependency"
Is it in the pom.xml? 
All I have in there is this:

<!-- GWT dependencies -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
</dependency>

Do I have to set a "scope"?

Thanks again,
Daniel


On Mon, Mar 12, 2018 at 1:31 PM, Thomas Broyer <t.broyer@gmail.com> wrote:


On Monday, March 12, 2018 at 12:55:22 PM UTC+1, dflorey wrote:
Hi folks,
after all those years I've decided to start migrating our GWT / App Engine (standard) projects from Ant to Maven.
The main app consists of several GWT libraries and multiple modules.
I'd also like to split the monolithic app into several "microservices" running on App Engine (frontend and backend).
Problem is that I've not used maven much in the past so there is a lot of new stuff to learn.

If you can, you may want to try Gradle instead of Maven. Migration from Ant should be much easier, as both Gradle and Ant use graphs of dependent tasks, whereas Maven uses a linear lifecycle where you bind plugin "goals" to predefined "phases".
 
I've Googled a bit in the last days to get the big picture, but I did not find any tutorials how to put it all together.
So I though it would be a good idea to try to collect as much info from the experts as possible and write down a tutorial for others facing the same situation.

What I did so far:
I've created a maven parent project as I thought it may be a good idea to have a child project for each app engine module / service.
I've added the first maven module (frontend) and created an empty project from the appengine standard archetype.

I tried to add the gwt maven plugin to this project, but I had no clue how to do that.
I copy/pasted the definitions from here into the pom:

You could have a look at the samples from the GWT SDK: https://gwt.googlesource.com/gwt/+/2.8.2/samples/mobilewebapp/
I strongly discourage putting client and server code inside the same Maven module though; so I'd suggest you rather take inspiration from my archetypes at https://github.com/tbroyer/gwt-maven-archetypes (disclosure: I don't use AppEngine, so I have no idea if it's easy, and what it takes, to run the AppEngine dev server within multi-module projects; IIRC, previous versions required you to "mvn install" the dependencies and start the dev server from your "server" module, but this may have –I hope it has– changed; even Jetty which had the same limitation for years eventually fixed their Maven plugin).
 
When running

maven gwt:compile

I just get this error:
[WARNING] Error: Could not find or load main class com.google.gwt.dev.Compiler

Any ideas?

First, you don't want to call those goals from the CLI, use the lifecycle phases instead. And in a multi-module project, as a rule of thumb, in addition to always run Maven from the root, stick to "mvn package" and "mvn verify" (and possibly use -DskipTests to skip the tests). So: mvn package -DskipTests

Wrt the error, make sure you have gwt-dev declared as a compile-time dependency.

--
You received this message because you are subscribed to a topic in the Google Groups "GWT Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-web-toolkit/-7o22adLgls/unsubscribe.
To unsubscribe from this group and all its topics, 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.

--
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